SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,756
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Inflated Page Counts - Reason for Concern?

    My website offers Articles on various topics. Beneath each Article is space for User Comments.

    Currently, each new Comment is just tacked on the bottom of the page, so if I get 283 Comments, it will be one very TALL page!!

    Because of this, I am thinking of adding in "pagination", however I do NOT want to use JavaScript, which leads to the topic of this thread...

    If I add Server-Side Pagination to my Article pages, then every time someone navigates to see more Comments, the same Article will be loaded again. This will be fine for going from Comments 1-10 to Comments 11-20, however, it will also "inflate" the Page Count for the given Article!!


    Is this really a problem in the scheme of things?


    For this version of my website, I am adamant about not wanting to use JavaScript. (Please save arguments against this for another time.)

    I can easily build Pagination just using PHP/Server-side Scripting, but will the side-effect of reloading the same page onto itself over and over again make me hate myself from a "Website Metrics" standpoint, or not really?

    I suppose a lot of it depends on how Users use my website. (If no one really reads or goes past the first 10 Comments, then this is a non-issue. Of course, the reason I added the Comments feature is that I hope there are TONS of User Comments!!)

    Thoughts?

    Sincerely,


    Debbie

  2. #2
    SitePoint Guru bronze trophy
    Join Date
    Feb 2013
    Posts
    673
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Setting and checking a SESSION['article_id_array'] would be a simple way to handle this. If not in the array, you add the count. Something like this.
    PHP Code:
    <?php    
        
    if (!isset($_SESSION['article_id_array'])){
            
    $_SESSION['article_id_array'] = array();
        }
        if (isset(
    $_SESSION['article_id_array']) && !in_array($article_id,$_SESSION['article_id_array'])){
            
    $_SESSION['article_id_array'][] = $article_id;
            
    //add your article count code here
        
    }    
    ?>

  3. #3
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,756
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Drummin View Post
    Setting and checking a SESSION['article_id_array'] would be a simple way to handle this. If not in the array, you add the count. Something like this.
    PHP Code:
    <?php    
        
    if (!isset($_SESSION['article_id_array'])){
            
    $_SESSION['article_id_array'] = array();
        }
        if (isset(
    $_SESSION['article_id_array']) && !in_array($article_id,$_SESSION['article_id_array'])){
            
    $_SESSION['article_id_array'][] = $article_id;
            
    //add your article count code here
        
    }    
    ?>
    I was referring to any "analytics" packages I might use, like Google Webmaster (or whatever it is called)...

    Sincerely,


    Debbie

  4. #4
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2006
    Location
    Augusta, Georgia, United States
    Posts
    4,139
    Mentioned
    16 Post(s)
    Tagged
    3 Thread(s)
    You would pass variables server to client-side using them to detect whether the page should be tracked or not.

    The question really becomes whether you would like to only track a single hit per unique user. If that is the case than use a database table to track whether they have seen the article or not. When they haven't seen the article in full place the tracking code on the page otherwise don't. Of course this becomes a little more tricky when it comes to anonymous users. In that case you could base it on session or perhaps IP.

    Though as most newspaper folks will tell you any refresh of the page is considered a hit the more the better! That is regardless of whether the article has been already viewed or not not. I mean I work for a newspaper and we track every hit. Though I do believe google analytics has the capability to filter out unique hits for a page.
    The only code I hate more than my own is everyone else's.

  5. #5
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,756
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by oddz View Post
    You would pass variables server to client-side using them to detect whether the page should be tracked or not.

    The question really becomes whether you would like to only track a single hit per unique user. If that is the case than use a database table to track whether they have seen the article or not. When they haven't seen the article in full place the tracking code on the page otherwise don't. Of course this becomes a little more tricky when it comes to anonymous users. In that case you could base it on session or perhaps IP.

    Though as most newspaper folks will tell you any refresh of the page is considered a hit the more the better! That is regardless of whether the article has been already viewed or not not. I mean I work for a newspaper and we track every hit. Though I do believe google analytics has the capability to filter out unique hits for a page.
    A few things...

    First of all, to be clear, here is what I am afraid of...

    Being anti-JavaScript, I build server-side PHP code which provides "pagination" for each Article.

    Then, one day Jane Doe goes to the article "Best Cities for Small Business" and reads it. My Analytics package - I'll probably use one of the open-source ones - ticks one count for that page.

    All is well.

    But then Jane Doe starts reading people's comments about the Article, and it turns out that a heated debate started, and there are over 20 pages of Comments.

    Being at *work* and having nothing to fill her time Jane Doe systematically clicks "Next >>" 19 more times to read everyone's Comments, and so my Analytics software ticks up 19 more counts for that page.

    Sunday night I'm seeing how my website did, and low and behold I see - pretend there is only one visitor to my site - that my prized article "Best Cities for Small Business" just got 20 hits!!!

    (Of course, in reality, there was only ONE visitor and ONE hit?!)


    Secondly, in the past when I was using my Web Host's Analytics Software - before they stopped offering it - the way it worked was like this...

    They gave me some code to copy and place in an include script, which I then "Included" on every page I wanted to track.

    It sounds like you were saying above, that to counteract things, I'd need to write some logic to affect when things got counted, is that correct?


    Finally, so I am unclear what your recommendation is...

    I think I hear you saying "A Hit is a Hit", but I'm not totally sure?!

    Am I worrying about things that in the scheme of things won't matter, or do I have valid concerns?

    (I don't care if 100 People read the same Article but page through the Comments resulting in 150 Hits. But I would care if 100 People read the same Article, go wild over the Comments section, and it appears to me that I had 2,000 Hits?!)

    Sincerely,


    Debbie

  6. #6
    SitePoint Guru bronze trophy
    Join Date
    Feb 2013
    Posts
    673
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DoubleDee View Post
    I was referring to any "analytics" packages I might use, like Google Webmaster (or whatever it is called)...

    Sincerely,


    Debbie
    Coding a hit counter is pretty straight forward though Goggle analytics is pretty cool. In either case, using a session check like I posted would only track one hit during pagination, posting comment or refresh.

  7. #7
    Mouse catcher silver trophy Stevie D's Avatar
    Join Date
    Mar 2006
    Location
    Yorkshire, UK
    Posts
    5,881
    Mentioned
    122 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by oddz View Post
    Though as most newspaper folks will tell you any refresh of the page is considered a hit – the more the better! That is regardless of whether the article has been already viewed or not not. I mean I work for a newspaper and we track every hit.
    It depends for what purpose you're tracking hits. If it's to get a better deal with advertisers, or just general willy-waving, then yes you will want to count every hit separately. But if you are analysing the data for your own benefit, ie seeing which articles are the most popular, then that's unhelpful, and what you really need to know is how many people have read each article.

  8. #8
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,756
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Stevie D View Post
    It depends for what purpose you're tracking hits. If it's to get a better deal with advertisers, or just general willy-waving, then yes you will want to count every hit separately. But if you are analysing the data for your own benefit, ie seeing which articles are the most popular, then that's unhelpful, and what you really need to know is how many people have read each article.
    I'm tracking solely for my benefit so I know how my website is doing.

    That said, do you think I could just write some PHP code which determines when to access the "tracking code" most Analytics packages have you stick on each page? (That would be much easier than having to use JavaScript!!)

    Sincerely,


    Debbie


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
  •