• _mf_

    (@_mf_)


    Hello,
    I’ve been looking around the wiki and forums but haven’t found anything about a counter indicating how many times a post has been read. This helps internally to later determine the most popular (read) posts, and also as a nice public stats feature. Is this what is meant by “Activity logging” (among other features) in the Future section of the site ?
    I’d appreciate any pointers if this already exists, maybe I’m too sleep deprived to notice it.
    Cheers,
    mf.

Viewing 14 replies - 16 through 29 (of 29 total)
  • Chris J. Davis

    (@chrisjdavis)

    I have run into a potential… shall we say snag in this hack. I am not sure but I think that I am getting infalted results from search engine spiders.
    Some of my posts are at around 150+ views in 1 – 2 days, while some are still at 0 or 1 -3. I actually get a decent amount of traffic, but I wouldn’t think I am getting that much on just one or two posts.
    I am going to look at hacking in some spider-handling to this, and I will let you guys know what happens.
    Chris

    LoganSix

    (@logansix)

    I haven’t made any changes to get this working properly, but I want to point out that you should also put a IP tracker in it, so that refreshing the page doesn’t add to the count.
    Just a thought.

    This is a pageview counter. If you really want a unique-views counter, you’ll want to take something like the refererLib stuff, extend it to allow null referers, and verify that a given IP with a blank referral and a given post page aren’t in the last say 24h of entries.
    I’ve noticed my post count goes up weirdly while I’m editing draft/private posts. Now, I am using my own ‘variation’ on this theme, but it uses the same basic thought process. It also has a bail-out check for admin users (which should mean no accessing I do should ever cause a read-hit…). I think there’s something wacky, maybe my field is somehow set to autoincr or something like that.. hmnm….
    -d
    https://www.chait.net

    Call me nit picky or something, but I think using the referrerLib is probably better for getting a more accurate count. What’s the point of putting a count out, if you can’t make it as accurate as possible.
    Now, I can see were having the count shoot up like a Saturn V rocket would help a person’s ego, but I prefer to get a more realistic view of who’s checking out my posts.
    Thanks for the work David, I look forward to the updated version to try out.

    i really dont understand what im doing wrong… ??

    i followed every step , the obly changes i made was changing the table name to wp_mostAccessed , and changed every time i saw mostAccessed to wp_table mostAccessed…

    But nothing is showing…not even errors! . . . the code to show how many time the “read more” is suposto to be :

    <?php show_post_count($post->ID, $before=”(Visited “, $after=” times)”); ?>

    right?

    i put it , and its supost to appear after the :

    “by Prim3r”
    the website is here :

    https://www.prim3r.nextdesigns.net/

    btw , i chech the table on mysqladmin and its empty….

    Do you have this line:
    <?php if ($single) { add_count($post->ID); } ?>
    right underneath this line:
    `<?php if (have_posts()) : while (have_posts()) : the_post(); ?>’
    in your main template ?

    yes like this :

    <div id=”content” class=”narrowcolumn”>
    <?php if (have_posts()) : ?>

    <?php while (have_posts()) : the_post(); ?>
    <?php if ($single) { add_count($post->ID); } ?>

    …..

    and where is supost to show is like this :

    <?php comments_popup_link(‘Leave a Comment ‘, ‘1 Comment ‘, ‘% Comments ‘); ?><br><?php show_post_count($post->ID, $before=”(Visited “, $after=” times)”); ?></div><div class=”clear”></div>

    maybe the error is on database…?

    I have this:
    <?php if (function_exists('show_post_count')) show_post_count($post->ID, $before="Read (", $after=")"); ?>
    so it could be… the table is still empty in the database ?

    right now im getting conection is refused…some isp problem i guess ??

    that code is diferent…maybe i should copy it and past over my code…?

    if not…mabye creating a temp admin acount if anyone want to help.

    onme question a little of topic :

    all my tables begin with : wp_

    so this one should have the same before the name right?…

    no – mine is just called ‘mostAccessed’ too..

    ok . . . its no use!

    I activated the plug in i put the code :

    <?php if($id > 0) { add_count($id);} ?>

    after the : <?php while (have_posts()) : the_post(); ?>

    and to appear :

    <?php comments_popup_link(‘Leave a Comment ‘, ‘1 Comment ‘, ‘% Comments ‘); ?><br><?php show_post_count($post->ID, $before=”(Visited “, $after=” times)”); ?>

    the result is…nothing! nothing appear on website ??

Viewing 14 replies - 16 through 29 (of 29 total)
  • The topic ‘REQ: Post read X times counter’ is closed to new replies.