How to Install Google Analytics in WordPress

July 26, 2018

How to Install Google Analytics in WordPress

Wordpress is the most popular Content Management System based on PHP and MYSQL providing free and open source service. Wordpress is allied with blogging with an additional feature to support other types of web content including mailing lists and forums, online stores and media galleries. Google Analytics provides robust and detailed reporting on blogs which enhances the utility of WordPress.


To install google analytics in WordPress you will require three components:

  • Google Analytics Account
  • Google Tag Manager Account
  • Google Tag Manager Plugin for WordPress.


Google analytics in WordPress can be installed by following a number of procedures. Here, three methods are described by which google analytics can be installed in WordPress:

  • Google analytics by MonsterInsights
  • By inserting headers and footers plugin
  • Installing google analytics in Wordpress theme

Google Analytics for WordPress by MonsterInsights

It is the most convenient and efficient method to add google analytics to WordPress. It can be easily used by the beginners as well as by the experts. Monsterinsights provides the feature of the free version and pro version. Monsterinsights pro version is used in order to facilitate more advanced features like E-commerce tracking, ads tracking, authors tracking etc. Monsterinsights google analytics plugin is used by a number of websites including the likes of Bloomberg, Playstations, Zillow and many more.

  • The first step which is needed to be carried out is to install and activate MONSTERINSIGHTS PLUGIN.
  • After the activation of the plugin, there will appear a new menu item labeled as INSIGHTS over the WordPress admin menu.
  • Proceed by clicking INSIGHTS and go to the SETTINGS button to configure the plugin settings.
  • A new screen will appear, you need to click on AUTHENTICATE WITH YOUR GOOGLE ACCOUNT button to synchronize google analytics with your WordPress site.
  • After authenticating with the google account you will be redirected to your google account and you will be asked to sign in.
  • If you have already signed in, you need to select your google account.
  • After selecting the google account click on the NEXT button to continue the procedure.
  • Monsterinsights seek permission to access your Google analytics account, So you will be asked to allow the access.
    • Click on ALLOW button to proceed.
    • Now you need to select the profile which you want to track.
    • Select the website here and then click on COMPLETE AUTHENTICATION button to continue.
  • This process redirects back to your WordPress site, which is the final step of successful installation of google analytics on your WordPress site.
  • Monsterinsights provide facility to view your Google Analytics Report inside your Wordpress dashboard.
  • The steps to visit report are as follow:
    • Go to INSIGHTS button.
    • Then click on REPORTS button to display the Google Analytics Report

Insert Headers and Footers Plugin

This method of installing Google Analytics in Wordpress is not as efficient as the previous one since it does not facilitates with advanced features of tracking configuration, also it does not allow you to visit the Google Analytics Report in the WordPress dashboard.

Following steps are involved to setup Google Analytics:

  • Install and activate the INSERT HEADERS AND FOOTERS plugin.
  • After activation, go to the SETTINGS button.
  • Then click on INSERT HEADERS AND FOOTERS page.
  • Paste the Google Analytics code which is copied into the headers section.
  • Click on save SAVE CHANGES button to store the settings. This is the final step of successful installation of Google Analytics in WordPress.

Install Google Analytics in WordPress Theme

This is the rarely used method for installing Google Analytics in WordPress which is used by an expertise person or someone who is familiar with codes. This method needs an advanced user as it is somewhat unreliable and codes get disappear if you switch or update the theme.

Steps involved in following this procedure are:

  • Add the code in php.header file.
  • In this step simply edit the header.php file in your WordPress theme and then paste the code copied earlier after the tag.
  • Click on SAVE CHANGES to store the changes and upload the file back to the server.

You can also add the code via FUNCTIONS FILE by attaching Google Analytics tracking code to Wordpress function file. The code will be automatically added to every page of your WordPress site. proceed by adding this code to FUNCTIONS.PHP file.


  • Google Analytics provides ease to understand the reports on the WordPress dashboard.
  • It provides a guide for the beginners to interpret the data.
  • It provides an open source freemium service for websites of all sizes.
  • Google Analytics provides the information regarding the traffic to your website.

Leave a comment