Using "Page Views Count" plug-in we can track the number of visits by visitors on each page, post, or other objects.
This plugin creates two tables to store the total counts and today's counts.
- pvc_daily - store today's visit counts.
- pvc_total - stores the up to date total visit counts including today's.
To better viewing the data, create a view called v_post_count:
SELECT p.id,p.post_title,u.display_name,t.postcount total, d.postcount today,p.post_date FROM wp_posts p left join wp_pvc_daily d on p.id=d.postnum and d.id in (select max(id) from wp_pvc_daily group by postnum) left join wp_pvc_total t on t.postnum=p.ID left join wp_users u on u.ID=p.post_author where p.post_status='publish' and p.post_type in ('page','post','tribe_events','wpcf7_contact_form') order by d.postcount desc
Or
SELECT p.id,p.post_title,u.display_name,t.postcount total, d.postcount today,p.post_date FROM wp_posts p left join wp_pvc_daily d on p.id=d.postnum and d.id in (select max(id) from wp_pvc_daily group by postnum) left join (SELECT postnum,sum(postcount) postcount FROM wp_pvc_daily group by postnum order by sum(postcount)) t on t.postnum=p.ID left join wp_users u on u.ID=p.post_author where p.post_status='publish' and p.post_type in ('page','post','tribe_events','wpcf7_contact_form') order by d.postcount desc
After activating the plugin, you need to change the settings from the panel.
Comments