• I have a php function that updates a counter in wp_postmeta for each post when its page template is executed. It ignores a simple F5 refresh to prevent fake hits.

    However, I just realized that my viewcounts are about 1/3 of what google analytics says, and I’m pretty sure it is because wp_super_cache faithfully and quickly serves a static page to all anonymous visitors. Apparently my plugin is only executing for logged in users (non-cached pages).

    So before I dig into this, can someone clarify for me if this filter is intended for executing php code regardless of caching? I do not need to display anything, but just want to record all pageviews without installing some bloated plugin to do it. 🙂

    Thanks, Ron

    update: I read that mod_rewrite caching (recommended) and the wpsc_cachedata filter are mutually exclusive. The plugin author also states that using javascript to update content that must be dynamic is “recommended”. Can someone (Donncha?) confirm that is still true? I know how to do some ajax stuff so is it really a better strategy to call my php function after pageload?

    http://wordpress.org/plugins/wp-super-cache/

Viewing 1 replies (of 1 total)
  • Thread Starter Ron Strilaeff

    (@ronstrilaeff)

    I spent some time to create an ajax call (after page load) to my update view count function, but it still won’t execute for cached pages!

    I know it works for ratings and favorites (with serverside php and database updates) but those depend on a user action like clicking on something.

    Has anybody been able to execute ajax automatically after a cached page is ready? Any advice is greatly appreciated.

    btw: I’ve abandoned my original strategy of using that wpsc_cachedata hook because I want to use the mod_rewrite method of caching.

Viewing 1 replies (of 1 total)
  • The topic ‘Using wpsc_cachedata to count ALL pageviews’ is closed to new replies.