Google Analytics Slow – Speed Up Google Analytics Easy

Google Analytics Slow – Speed Up Google Analytics EASY

Need to speed up Google Analytics?

So the big hurdle with speeding up a WordPress site that users run into almost all the time is speeding up scripts that run on other sites.   In the process of WordPress Speed Optimization it is very routine to speed up the scripts that reside on the actual server the site is running on but you can not do that on those scripts that need to be called on to load from other sites. 

Believe us we know the frustration of this fact all too well.

A script that you will find on the majority of WordPress sites is Google Analytics.  This is used often because it is an amazing tracking tool to study and research your site traffic.  Now in general the script itself is pretty fast and stable. 

But we do see that from time to time the loading of this script will spike and cause the entire load time of any page on your site to slow down.

We we have a solution that will allow you to bring this script into your world so you can load it faster.  We have used this technique on hundreds of sites and have seen amazing consistent increases in speed.  Take a look below at the before and after speed test results.

Speed Up Google Analytics

BEFORE: – Speed Up Google Analytics

WordPress Support

AFTER: – Speed Up Google Analytics

So now let us get into the actual process of making this happen so you can gain some more speed!


Make The Google Analytics Script Local

First thing you need to do is to take the actual script file needed to run Google Analytics and put it on your server. We have created this file for you which you can download at the link below. This is a file has been zipped up so make certain you unzip it before using it.

https://www.wpfixit.com/wp-content/uploads/2017/09/gas.zip

After you do unzip it, place it in a location on your hosting account. A very common place for this is inside of your child theme somewhere but it does not really matter where you place this file as long as you know the full path to it. An example path would be https://domain.com/wp-content/themes/child-theme/js/gas.js


Load the Local Google Analytics Script

So now you are going to adjust the code below replacing where it says FULL_PATH_TO_FILE with the path to where you placed the gas.js file. You will also need to replace the area in the code that says GA_TRACKING_ID with your unique ID.

Then this code will be placed in your website before the closing tag. Be sure to remove the code you used prior to run Google Analytics.

<script>
var _gaq = [['_setAccount', 'UA-GA_TRACKING_ID'], ['_trackPageview']];
 setTimeout(function() {
 var g = document.createElement('script'),
 s = document.scripts[0];
 g.src = 'FULL_PATH_TO_FILE';
 s.parentNode.insertBefore(g, s);
 }, 0);
</script> 

Doing this simple process will surely Speed Up Google Analytics and make sure it loads fast consistently. SPEED BABY!!!!


Here is a Plugin that will do all this for you

WordPress Support


A cool plugin created by Daan van den Bergh that enables you to complete optimize the usage of Google Analytics on your WordPress Website. Host your Google Analytics javascript-file (analytics.js) locally and keep it updated using wp_cron().

Easily Anonymize the IP-address of your visitors. Set an Adjusted Bounce Rate. Decide whether to load the Analytics Tracking-code in the header or footer. And more! CHECK IT OUT AT https://wordpress.org/plugins/host-analyticsjs-local

Hopefully this was helpful for speeding up this slow script on your site. Speed is soooo important for user experience and search engine ranking. You need to take speed seriously.

Follow these easy tips to Speed Up Google Analytics and reach more online success. GET AT IT TODAY!

12 Comments

  • You did not explain where the code of step two goes. (the script code with tracking id).

    thanks

    Reply
    • The code is always placed before the closing tag as explained inside your Google Analytics account.

      Reply
  • Hi there, 

    Didn’t knew that we can host the code locally. With this code, we can collect data of events etc? 

    is it like, we are hosting the code ourself, and it works as usual? 

    Reply
    • Yes works great. Would not write this post if it did not function…;)

      Reply
      • I’m sure Google periodically updates the script. How do you keep it updated locally?

        Reply
  • Hey!

    My site was ranking 100/100 on GTMetrix. Once after I activated this plugin-in to incorporate GA, it became 100/99. The Y-Slow shows “Minify CSS and JS files” and says “inline tag #3”. How can I get rid of this? I’ve ensured the score went down to 99 only after activating this plugin-in by deactivating it once. When I deactivated this plug-in the score came back to 100/100. I need this plug-in to insert my GA code and yet retain my 100/100 score. Is this something you can help with?

    Reply
    • I think it is best to not use the plugin then. Also the difference between 99 and 100 is not really anything to worry about. It is also important to understand that scores do not matter. It is all abbot actual load time.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *



FREE SPEED AUDIT