Skip to main content

For WordPress beginners learning how to install Google Analytics on WordPress can be difficult. In this article we will outline the steps to getting Google Analytics installed and operational.

Google analytics is a great free tool which allows easy tracking and evaluation of user traffic to your website. To find out more about Google Analytics and the features it offers read our Intro to Google Analytics article.

Google Analytics Account Setup

First you will need to create a google analytics account. This is done by visiting Google marketing suite and creating a Google Analytics account:

marketingplatform.google.com.

If you have an existing Google Account you can use this to sign in or you will need to create a new Google Account to access analytics.

Once you are logged-in you can create your new Google Analytics account. Note: Within the Google Analytics application, it is structured in the following way:

  1. Accounts
  2. Properties
  3. Views

Managing the structure of your Google Analytics account is very much up to your specific organization. Google has provided some helpful definitions of the structure and options on setup: https://support.google.com/analytics/answer/1009618?hl=en#Accounts

New Google Analytics Account

Once you have signed in to Google Analytics you will be asked to setup a new account.

How to install Google Analytics on WordPressYou will be asked and need to fill in the following:

  1. What would you like to Track? You can choose either a Website or Mobile app.
  2. Now enter your account name, in most cases this is the business/organization name
  3. Next you will be asked to setup your property, this is the name of the application or website you would like to track.
  4. Next you will be asked for the URL of the website you would like to track. Note: ensure you enter https if your website has a SSL certificate installed.
  5. Next select the relevant industry category
  6. Next set the reporting time-zone you would like to set on the account.
  7. Google then asks what data you consent to sharing with them. Again this is very much up to the policy of your organization. Select/Deselect the options relevant for your company.
  8. Select the “Get Tracking ID” button

You will now be taken to the Tracking Code view with the Track ID number on the top of the screen along with the Global Site Tag (gtag.js) code. Copy and save the code presented which will look something like:

google-analytics-property-setupKeep your Google Analytics account open and open a new tab in your browser.

How to Install Google Analytics on WordPress

Now that your Google Analytics account is setup along with the new website property, you need to add this to your WordPress site.

There are two easy ways this can be done:

  1. Most themes have the option of adding Google Analytics code to them in the Theme customize or control panel. Ensure you have thoroughly reviewed your themes documentation to see if this is an option.
  2. The second simple option is to use the WordPress plugin “Insert Headers & Footers” https://wordpress.org/plugins/insert-headers-and-footers/

We will cover how to setup using the second option.

In the new tab you just opened login to your WordPress admin panel and:

  1. Navigate to the plugins tab and select “Add new”.
  2. Search for new plugin “Insert headers and Footers”
  3. Install and Activate the plugin
  4. Navigate to the Settings menu item and locate “Insert headers & footers”
  5. Copy the Global Site Tag you were given from Google Analytics and paste into the scripts in header code block.
  6. Select Save.

How to install Google Analytics on WordPress

You will now need to ensure the code has been installed correctly and is tracking users. To do this, navigate to the front-end of your WordPress site and scroll down the page.

Navigate back to the open Google Analytics tab. In the left-hand-side menu select the clock icon, “Real-Time > Overview” Report. You should then see 1 active user on your site if the tracking has been implemented correctly.

Google Analytics Real-time report

You are now setup and tracking website traffic to your WordPress site.

It is also important to filter out internal traffic to your website, to ensure you are not artificially inflating your numbers. For more on how to exclude this data from your property see our article – How to exclude your IP Address from Google Analytics.

Jen Cork

Author Jen Cork

More posts by Jen Cork

Leave a Reply