Support » Fixing WordPress » [Plugin: Stats] Fix for Stats not recording page views

  • Resolved panscendo


    After I upgraded and changed my page template, Stats was no longer recording any page hits. After some time lurking on the forums and trying different things I finally figured out what the problem was. Hopefully my fix may help someone else.

    In the Stats php file I noticed that the tracker is added by appending the code to the wp_footer() function called by the page templates. If the template doesn’t use wp_footer() then the Stats tracker wont be added. So I checked my template to make sure that it was in fact calling that function. Nope, it wasn’t – it was calling get_footer(). So I edited the Stats .php file and changed ‘wp_footer()’ to ‘get_footer()’.

    Disclaimer: I did this a few days ago so details may be a bit fuzzy. Also, I basically have no idea what I was doing so use this fix at your own risk. Devs, anything to add?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Good call.

    I’ve been sitting there for weeks saying “I know I have visitors, I have comments”.

    I duplicated the line, figuring if I switch themes, the page will use one or the other, so cover my bases:

    stats/stats.php – toward the bottom:

    // Plant the tracking code in the footer
    add_action( 'wp_footer', 'stats_footer', 101 );
    add_action( 'get_footer', 'stats_footer', 101 );

    thanx for the tip 🙂 gonna see if it works 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Stats] Fix for Stats not recording page views’ is closed to new replies.