To add front-end post views count?
-
Hi, I have a “Post Views Counter” plugin on my website, and it shows a views counter at the beginning of each post. Here is, how it looks: https://ibb.co/xgwrHct
Your plugin counts post views as well. So, my idea is: maybe you should add this counter at front-end as well? Because the plugin, that I mentioned above, counts views very bad (probably 2-3 times less, than the actual stats).
The page I need help with: [log in to see the link]
-
2. Yes, I understand it, but I don’t have so many repeated visits throughout day (and so much bots to mess up my stats, because I use an antibot service). I am measuring my views stats with the help of Yandex Metrika (it’s a Google Analytics analogue). And also I use my antibot stats. I usually have viewing depth around 2,06 (which means, that 1 user views 2,06 pages per visit on average). So if I have 600-700 visitors per day (which I usually have atm), then I get around 1300-1400 views per day. And in the past WPP was showing such numbers as well. And my antibot stats still show such numbers. But atm WPP showed 900 for yesterday, (it’s 00:22 in my local time). I have a suspicion, that one of these codes cuts some real views for some reason.
3. I’ll explain: some of these top-5 posts in admin panel (https://ibb.co/jRqHQdf) sometimes don’t match with these top-5 posts in sidebar (https://ibb.co/CnFh9CW). Even though I don’t cache them through your plugin, but they are cached through WP Fastest Cache plugin (cache resets every 10 hours). However, I am logged-in as admin, and I don’t use cache for admins, so every change has to be shown immediately. But it’s not in this case. For example, the new day started 22 minutes ago in my local time, but in sidebar there are still top-posts from yesterday. I have a suspicion, that in sidebar popular posts are renewed with delay even for admin, for some reason.
I have a suspicion, that one of these codes cuts some real views for some reason.
Could be, yes. These are experimental scripts after all. You can always remove one or both of them and see what happens. Alternatively, you can also have a developer with access to your site take a closer look for you.
I have a suspicion, that in sidebar popular posts are renewed with delay even for admin, for some reason.
Well, by default the plugin caches data for performance reasons so it could be that. Or some other setting that’s different between the two lists. These screenshots you shared don’t really say anything other than the lists displaying different entries.
Check that you’re using the exact same settings on the Stats page than the ones from your front-end list.
Could be, yes. These are experimental scripts after all. You can always remove one or both of them and see what happens.
I removed both scripts and noticed, that my page views numbers in WPP stats has increased. Now they are much closer to my page views stats in Yandex Metrica and antibot. So I guess, the problem is in this scripts…
Well, by default the plugin caches data for performance reasons so it could be that.
I have this option turned off in WPP settings.
Check that you’re using the exact same settings on the Stats page than the ones from your front-end list.
In WPP stats settings I have all options turned off (caching, AJAX using etc). And in sidebar I use a [wpp] shortcode (which is used only on ‘post’ type of pages), because I use a classic editor, and turned off all scripts for content blocks, including yours. Here is my shortcode:
[wpp range='last24hours' limit=5 post_type='post' thumbnail_width=75 thumbnail_height=75 stats_views=0 wpp_start='<ul class="wpp-list wpp-cards-compact">' post_html='<li class="{current_class}">{thumb}<div class="wpp-item-data"><div class="taxonomies"></div>{title}</div></li>' wpp_end='</ul>']
And also I use a code, that you gave to me (for content-single.php file):
<div class="entry-meta"> <?php if ( function_exists('wpp_get_views') ) { echo '<div class="meta-item"><i class="fa fa-eye"></i> <span>ПРОСМОТРОВ:</span> <span>' . wpp_get_views( get_the_ID() ) . '</span></div>'; } ?> <div class="meta-item"> <i class="fa fa-calendar"></i> <span class="updated"><?php the_date( 'd.m.Y' ); ?></span> </div> </div>
In WPP stats settings I have all options turned off (…)
Could you please take a couple of screenshots of your entire Statistics screen?
- One screenshot of your entire Stats screen, not just the post list.
- One screenshot of the settings that you’re using with your Stats screen (click on the Cog icon at the top left of the stats screen, then take a screenshot of the settings popup that will appear.)
And also I use a code, that you gave to me (…)
That’s for the views counter under your post title, it’s not really related to your other issues.
- Here are stats for today: https://ibb.co/DzWxmKq
- Here is my settings popup: https://ibb.co/QrkGqHd
Thanks, that clarifies things.
So you’re using this with your shortcode:
[wpp range='last24hours' ...]
You’re asking the shortcode to list the most viewed posts from the last 24 hours.
In your Stats dashboard, you’re viewing today’s most viewed posts.
“Today” is not equal to “last 24 hours”. For example:
- Today: 2024-12-19 00:00:00 AM to 2024-12-19 11:59:59 PM
- Last 24 hours: 2024-12-18 02:23:00 PM to 2024-12-19 02:23:00 PM
See the difference? In short, this is why the list you see on your Stats screen is different from the one you see on your site’s sidebar: different time ranges.
Edit: Also, you’re asking the shortcode to only display posts:
[wpp ... post_type='post' ...]
And your Stats screen is configured to list both posts and pages. This will also make a difference between the two lists.
-
This reply was modified 3 months ago by
Hector Cabrera.
Oh, now I understand, thanks! But can I somehow put wpp range for today’s stats only? I can’t see it in possible values tab. Or it’s possible only for WPP stats settings?
No, it’s not possible at the moment unfortunately. I don’t recall the exact reason why it’s not possible though so I may look into adding a “today” option in the future so this discussion was a positive thing!
That would be great, thanks!
P.S. I’ve just returned both scripts (additional views with page reload exclusion and bot views exclusion) in my functions.php file. I guess, it’ll start to lower my posts views again.
I hope, that these scripts will be improved in future… Tbh, I am more worried about post views count stats from another script (which is in content-single.php file). I don’t want frontend views count to be wrongfully lowered…
- You must be logged in to reply to this topic.