I've been using this function to Display Popular Posts by Views in Wordpress http://www.wpbeginner.com/wp-tutorials/how-to-track-popular-posts-by-views-in-wordpress-without-a-plugin/
Then i added w3 total cache and the counter doesn't get updated as often.
I've attempted fragment caching as per the tut and other sources
<!-- mfunc wpb_set_post_views($post_id); --><!-- /mfunc -->
But it isn't updating the counter. The tut (or any of the others) doesn't specify whether that line goes in php tags or in the html.
I've tried both. In php tags it breaks the page. Outside php tags in the regular html it doesn't count and just renders as a comment when you view source.
Anyone else had this problem? how did you resolve?
Ta in advance,
Kes