WebDoze Logo

How To Optimize Analytics Code In WordPress and Increase Site Speed

Table Of Contents

Share Article

Most of the sites are using Google Analytics to track visitors and have different reports. The default Analytics code can be heavy and will increase your site load time. In this article, we will see how easy is in WordPress to optimize Analytics and have your site load faster.

The optimization will be done with the help of a plugin and the results are as follows after using it:

Before:

After:

As can be seen the load time decreased but this can be also from the server communication and processes, the important thing is that the page size decreased with more then 10KB and we have fewer request.

Steps to Optimize Google Analytics in WordPress

Bellow are the easy steps to have this done on your WordPress Website:

1.Remove the previous code

In case you have Analytics already set deactivate the old plugin you are using or remove the code from the footer or header.

2. Install Flying Analytics

Flying Analytics is a WordPress plugin developed by Gijo from wpspeedmatters.com that will add a reduced analytics code on your site or the default one but loaded locally.

3. Configure Flying Analytics

After the plugin is installed you need to go into SettingsFlying Analytics and add your tracking ID.

Then you can chose from :

  • Gtag (Global Site Tag) is a combination of Analytics.js and Conversion.js. Conversion.js is usually used for AdWords.
  • Analytics.js is the standard script for Google Analytics, which includes all the features
  • Minimal Analytics is a “minimal” version of Analytics.js with only basic features. ‘Site Speed’ and some advanced features are not available.
  • Inlined version injects the script directly in HTML. So no extra request is required. But increases HTML size, no caching or CDN.

After you should have an analytics code that will speed up your website load time.

Become a CloudPanel Expert

This course will teach you everything you need to know about web server management, from installation to backup and security.
Leave a Reply

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