SitePoint Sponsor

User Tag List

Results 1 to 13 of 13
  1. #1
    SitePoint Guru
    Join Date
    Aug 2004
    Location
    Taunton, UK
    Posts
    787
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Tracking stats for advertisers on site

    The site I am developing is an accommodation directory and I would like to add the ability for people advertising their accommodation to view how many times their accommodation has been viewed on my site.

    The only way I can think of doing this is add a 'views' counter variable in the accommodation table and then every time a user views a particualar accommodation listing to update this variable.

    Does this sound a sensible solution or is there a better way of dealing with this?

    Thanks

    Paul
    Mediakitchen Limited
    App Development | Website Design & Development | Flash Game Development
    Somerset, UK
    http://www.mediakitchen.co.uk

  2. #2
    SitePoint Enthusiast
    Join Date
    Dec 2008
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's what I would do...it's pretty much standard. You might want to do a check on IP, so that you only up the count once. Or only once per session. Or set a cookie to track returning customers...

  3. #3
    SitePoint Guru
    Join Date
    Aug 2004
    Location
    Taunton, UK
    Posts
    787
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Fluffy convict.

    I am thinking it would be useful to know the date and possibly the time when the views where made. If I wanted to store this info too, would I be better having a separate table for tracking info that had a reference to the accommodation table/listing?
    Mediakitchen Limited
    App Development | Website Design & Development | Flash Game Development
    Somerset, UK
    http://www.mediakitchen.co.uk

  4. #4
    SitePoint Zealot
    Join Date
    Dec 2008
    Posts
    120
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It is better to add some kind of javasript counter because some of the hist on your site are from search engines and it is not a visit.

  5. #5
    SitePoint Guru
    Join Date
    Aug 2004
    Location
    Taunton, UK
    Posts
    787
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm I need to have separate stats for each advertiser - would javascript enable me to do this?

    Basically if my site has 3 hotels listed by 3 separate advertisers, I want to be able to let them each see how many visitors have viewed their hotel listing within the last week,month etc
    Mediakitchen Limited
    App Development | Website Design & Development | Flash Game Development
    Somerset, UK
    http://www.mediakitchen.co.uk

  6. #6
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    It maybe a thought to include some unique information in there too, say IP address and / or browser agent. This will allow you to determine unique visits and depending on requirements, report against those.
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  7. #7
    SitePoint Guru
    Join Date
    Aug 2004
    Location
    Taunton, UK
    Posts
    787
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks SilverB - so do you think a separate tracking table is the way to go with this?
    Mediakitchen Limited
    App Development | Website Design & Development | Flash Game Development
    Somerset, UK
    http://www.mediakitchen.co.uk

  8. #8
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Sure, it's how I would approach it. If the pages are dynamic anyway, and will be making a connection to a database regardless, the incurred overhead will be negligible.


    • tracking_table
      • page(unique)
      • time
      • referring_page
      • user_agent
      • ip_address

    That should suffice, unless of course you only want page views...

    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  9. #9
    SitePoint Guru
    Join Date
    Aug 2004
    Location
    Taunton, UK
    Posts
    787
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks SilverB

    One more question.

    Where you have page, what kind of value should I include here.

    The actual link will be something like http://www.mysite.com/listing.php?id=5432

    Would I just store the id? or the entire URL?
    Mediakitchen Limited
    App Development | Website Design & Development | Flash Game Development
    Somerset, UK
    http://www.mediakitchen.co.uk

  10. #10
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    If the ID was unique to the page I wanted to track, I would just use the ID. There would be very little point storing the full URL when the it's only the ID we want.

    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  11. #11
    SitePoint Guru
    Join Date
    Aug 2004
    Location
    Taunton, UK
    Posts
    787
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Good point SilverB - I was just thinking the tracking may need to cater for the scenario where the advertiser wants to see tracking data on various pages. So if they had a general listing page called listing.php and a gallery page called listingGallery.php, by just storing the id, I would not be able to know which of these pages has been visited.

    Anyway I didn't mention this possibility in my original post and is just something that came to mind now. I think you have definitely given me the solution and reassurance I needed - cheers
    Mediakitchen Limited
    App Development | Website Design & Development | Flash Game Development
    Somerset, UK
    http://www.mediakitchen.co.uk

  12. #12
    SitePoint Enthusiast
    Join Date
    Dec 2008
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, just the id; this way, you can easily update the URL if you have to. Pseudo:
    PHP Code:
    $pages db_fetch_array(db_query("SELECT DISTINCT(page) AS id FROM {table}"));
    foreach (
    $pages as $page) {
      echo 
    "http://www.mysite.com/listing.php?id=" $page['id'];

    I think, BTW, the time has come for you to just start building it and if you run into problems post then iwth relevant code here. Practice is everything!

  13. #13
    SitePoint Guru
    Join Date
    Aug 2004
    Location
    Taunton, UK
    Posts
    787
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hehe yes Fluffy, I am on the case now. Thanks for all the advice from you and the others. I have been building this site of about 7 months now and it is really close to being complete - hooray!!
    Mediakitchen Limited
    App Development | Website Design & Development | Flash Game Development
    Somerset, UK
    http://www.mediakitchen.co.uk


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •