How to Install Google Analytics in WordPress

 What is Google Analytics?

Google Analytics is a software that tracks visitors and actions on your website. The purpose of tracking this data is to obtain metrics and see what people are doing on your website, and determine if your users are getting what they need or leaving your website quickly, as well as measure search term keywords, gathering acquisition data, and much more.

This tool will help you make more data driven decisions to your website based on your traffic data. Make sure to have a web design company handy! Read more on Google Analytics here 

The typical way of installing this is pasting your tracking javascript code into the HTML of your website, but on wordpress this will work slightly different. Read on to help yourself get Google Analytics installed into your WordPress website.


Getting Started with Google Analytics

To get started, you can create or use your existing Google account. Go to and Login or Sign up for a new Analytics account as shown below to get started.

Once you are signed in with your Gmail account, you will be prompted with a button to Sign up to Google Analytics, this will quickly create your Google Analytics profile associated to your Gmail account.
New Users will be presented with a menu to automatically create a new website “account” in your analytics account.
If you already have a Google Analytics account with an existing Analytics Website Account, you can skip this next screenshot and go directly to add a new property by:

  1. Clicking on Admin > Select Account.
  2. Click on Properties  dropdown
  3. Select the “Create New Property” option.


Creating a new account

This is for new users. If you already have an account you can skip this section and jump to the “Create new property” section
You will be presented with an option to select mobile app or website, select Website.

  1. For account name, enter the name of the account you will like to associate this blog with.
  2. For the Website Name, enter a readable name of the wordpress website
  3. For Website URL, Enter the url of your wordpress blog as shown in the example.
  4. Enter the Industry/Category and Timezone.

Once you submit this, you will be taken to the admin settings of your new account where a property is created and you can get your website tracking code.



Create new Property

Again, this is section is if you already have a configured Google Analytics account and skipped the previous section Create new Account.  You can skip this section and jump to the Next Steps section if you followed the previous step and have a new Analytics account.
To create a new property just for your wordpress blog under an existing account, simply login to your Google Analytics, and click on the ADMIN link on the bottom left of the screen as shown below.

By clicking this link you will be taken to the admin dashboard, where you will be able to click on the properties dropdown and select to create a new property

Then you will be prompted with a quick form to create your new website property as shown above. If you skipped the section above I will repeat here.
See this screenshot below of the form that will get create your new website property and present you with the tracking website tracking code.

  1. For account name, enter the name of the account you will like to associate this blog with.
  2. For the Website Name, enter a readable name of the wordpress website
  3. For Website URL, Enter the url of your wordpress blog as shown in the example.
  4. Enter the Industry/Category and Timezone.

Once you complete this form you can will then be prompted with the page that shows your website tracking code


Next Steps – Installing the Analytics code to your WordPress site

Here I will explain how to Install your Google Analytics tracking code into the HTML code of your wordpress blog. You can use a free plugin called MonsterInsights and will allow you to view Analytics data in your wordpress website. I personally recommend avoiding that just for security reasons if possible because if your wordpress blog is compromised it will be linked to your Google account. You can find quick articles on how to use the examples done above to integrate a WordPress plugin to your website and link to your Google Analytics account but I will not cover that here, you can find a good reference how to do this at WPBeginner and scroll down to the MonsterInsights section 1 titled “ Google Analytics for WordPress by MonsterInsights”

The two recommended ways of doing this would be:

  1. Use Header/Footer plugin to edit the header and footer sections of your website
    (Note if you are using a custom theme, this might not work, let us know if we can help we have our contact info below).
  2. Directly edit the themes HTML files, and reupload the theme into your wordpress account.

Using the header and footer plugin will let you edit the header and footer sections of your wordpress HTML code, where you can easily copy paste the website tracking code that is provided in the Google Analytics property section (screenshots above)

First, install the headers and footer plugin by searching for “header footer” and selecting the Install Now button on the plugin shown below.
This plugin is provided by WPBeginner  (Thank you!)

Once you install and activate your plugin, go to Settings > Insert Headers and Footers

Now, to possibly get more accurate stats, we should paste the website tracking code into the header section as shown below.
To accomplish this, go to your Google Analytics ADMIN > Select your Account, then Select your Property. Copy paste the full website tracking code as shown below

Once you copy this code paste it into your Headers and Footers setting on your wordpress page page as shown below

After this, click save and you can now verify your Google Analytics code will be in your website HTML code, and now you can start tracking your visitors and their actions.

The quickest way to validate this is to refresh your wordpress website, and view source by pressing CTRL+U (Command+U for Apple) and searching for </head>
Right before the </head> tag you should see the Google Analytics tracking code as shown below. Google Analytics will need either a few hours or days depending on your load of traffic to start showing you results.

Alternative Installation – Advanced Users

This section will assume that you have some experience working with custom WordPress Templates. Unzip  your theme into a directory and edit the header.php file. In here, you can place the website tracking code just before the ending </head> tag. Once complete, you can rezip your updated files, and go to WordPress Appearance > Themes  and re-install your theme.



If you need any assistance with this topic, or anything else wordpress websites, custom development or modifications to your existing website, don’t hesitate to contact us.
We are a Web Design and Development Company in Miami and work with Web Design which also includes wordpress websites, Development, SEO/PPC.

Reach us at 786-228-5224 or visit our website

Share: Facebook, Skype, Google+ Tags: Business, Corporate, Agency

Leave a comment