Support » Fixing WordPress » How to exclude jetpack stats module from rocketloader of cloudflare

  • I want to change the script type of Jetpack stats from “text/rocketscript” to “text/javascript”so that it would work correctly. I found the stats.php in wp-contents/plugins/jetpack/modules but i can’t change the script in there(there is no javascript in there) and i can’t find which function is calling stats.php in the page source.

    Please help me in this case.



Viewing 9 replies - 1 through 9 (of 9 total)
  • Brad


    I am not sure this will work or not, but try this, and please report back.

    1. Log into CloudFlare, and select the drop down for the domain

    2. Select “Page Rules”. Then look for “Add New Rule”.

    For the URL pattern, use the exact address to that folder followed my an asterisk to wildcard that entire folder.

    URL pattern should be something like:*

    3. Click the Performance dropdown and select “Off”. This will disable RocketLoader and any other optimization or minification options for files under this entire folder.

    4. Select “Add Rule”. I like to then purge the entire cache and also purge any caching plugins you may have installed on your WordPress site. Don’t forget to also clear your browser cache as well.

    Thanks, i tried that but i didn’t off the performance option. i inserted as

    and turned off the rocket loader. Even after that there was a huge difference between analytics and WP stats. Normally, it is between 100-200. but with rocket loader, it is more than 1000.

    I viewed the page source in chrome and i see this code:


    Last function



    When using CloudFlare, there will be a huge difference between on-server analytics and CloudFlare’s or 3rd parties since not all hosts utilize mod_cloudflare in their server setup which allows the origin server to see the IP address of the requester through CloudFlare.

    This is because CloudFlare acts as a reverse proxy and your server does not see all clients connecting to it, since they only connect to CloudFlare, and CloudFlare connects to your server.

    I would suggest using a 3rd party analytics provider for accurate stats.



    If Page Rules did not work, you may have to disable RocketLoader on your entire site.

    I am using google analytics for stats but actually WPstats was an inbuilt function within the dashboard so it was quite handy.

    Google analytics code too wasn’t working properly after activating rocket loader but i excluded it by adding this:

    <script data-cfasync=”false” type=”text/javascript”>
    —analytics code—

    so, if there is a way to change the wp stats code in a similar way?

    Thanks 🙂



    There may be if you can find that function in the plugin PHP code, but that is above the support of most at this help desk.

    Try looking in the plugin PHP files for something similar to:

    <script type=“text/javascript”> and replace it with <script data-cfasync=”false” type=”text/javascript”>

    That should continue to work until you update the plugin.

    Thanks, i will try it out if i find it by any chance (trying since hours :))

    Solution for the problem if anyone looking for this:

    Login to wordpress dashboard>Plugins>editor.

    Now click drop down menu after “Select plugin to edit” and select “jetpack by wordpress”. click select.

    Now, scroll down and click “jetpack/modules/stats.php”

    Scroll down in the editor window and look for the function something like this:

    <script src=”*****.js” type=”text/javascript”></script>
    <script type=”text/javascript”>
    {function here}

    Add “data-cfasync=”false” after script so that it would look something like this:

    <script “data-cfasync=”false” src=”*****.js” type=”text/javascript”></script>
    <script “data-cfasync=”false” type=”text/javascript”>
    {function here}

    Click “update” to update the file and now, rocket loader is off for jetpack stats code.

    Hope it helps someone.

    Make sure to repeat the steps after the plugin update.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘How to exclude jetpack stats module from rocketloader of cloudflare’ is closed to new replies.