install google analytics tracking code into wordpress header scripts section

How to Setup Google Analytics on WordPress

Home > Articles & Guides > How to Setup Google Analytics on WordPress

How to Setup Google Analytics on WordPress

WordPress website? The 10 minute guide for the do-it-yourself install

Last updated: 12th May 2020 | Level: Introductory | [GUIDE]

Setting up new Google Analytics on WordPress is very simple process which even the most non-tech savy can do. In this guide we take you through the process step-by-step with one of the most popular (and free!) web analytics platforms available.

Setup of Google Analytics on WordPress

Before you Start...You will need

This guide assumes you already have the following setup:

  1. A gmail account and email adress
  2. Your website up and running
  3. Administrator access to the WordPress installation

If you're not convinced you need web analytics on your site please review our article here 'Benefits of Web Analytics'

Note this setup guide is designed for those who are new to web analytics and need a non-technical DIY installation to get started quickly.

Step 1. Create a Google Analytics Property

Go to the Google at analytics.google.com and when prompted enter your gmail username and password. Ensure this is account which you want to be the administration account for your new Google Analytics property.

Once logged in you should see the Google Analytics welcome screen:

 

Google Analtics welcome screen

Google Analytics welcome screen

Click the 'Set up for free' button and you should be presented with the following:

creating a google analytics property for wordpress

Entering your company or organisation name into the Google Analytics settings

In the Account name field enter your Company name or brand. If you're a non-profit or community website just enter it's name. Don't worry too much this is just an friendly name to make it easy to identify the site so make sure it makes sense to you and anyone else who might look at Google Analytics in the future.  We suggest leaving the defaults for notificaitons ticked for beginners.  Click Next.

On the property type screen choose 'Web' at the what you want to track selection, like this:

select web property type in google analytic for your wordpress installation

Select property type of 'Web' to match your WordPress site

 

The next screen is where you setup the property configurations. So in here you will see options for site name, url, sector selection and language and timezone. Configure the appropriate settings and click 'Create'

choose the appropriate google analytics property settings for your wordpress site

Specifiying your name and url for the new property

Make sure to set the the url to https:// if your WordPress site runs over SSL.

After agreeing to the various terms and conditions and data storage agreements you will be presented with the following screen:

google analytics website tracking code to copy into your wordpress website

Copying the Google Analytics tracking code for your new property

This tracking code is the under the section 'Global Site Tag' is the tiny snippet of code you need to install into your wordpress site. Don't worry as you don't need to make any modifications just select all the code (including the <script> tags and paste it into notepad.  We'll come back for it in a minute.
advertisement


Step 2. Prepare your WordPress website

Next we need to setup WordPress ready to recieve the Google Analytics tracking code.

Jump over to your WordPress site and login, typically the url will be your home url with the path /dashboard appended to the end.

From your dashboard expand the 'Plugins' section and select 'Add New'. In the search box top right hand side enter 'Insert Headers and Footers'. The top entry in the returned list be the popular plugin by  the popular developer WPBeginner. Click install and then 'Activate'

install insert headers and footers into wordpress

Installing a script injector into WordPress

WordPress Navigation

Plugins > Add New >

You should receive a success message after installation and no errors when you Activiate your new plugin.

Step 3. Inserting the Google Analytics Tracking code

Now navigate to the newly installed plug-in's settings by selecting 'Settings' and then 'Insert Headers and Footers'.  You'll be presented with three panels into which you can enter scripts. Our Google Analytics tracking code needs to be inserted into the first section. Your screen should look like this:

install google analytics tracking code into wordpress header scripts section

Inserting the Google Analytics tacking code into the Header section of WordPress

 

WordPress Navigation

Settings > Insert Headers & Footers >

Click into the 'Scripts in Header' box at the top and paste in the Google Analytics tracking code you placed into notepad in step 1.  Remember to insert the closing </script> tag.  Click Save and that's the end of the setup and installation steps.

Finished

Step 4. Checks and Testing

Now to make sure you've setup everything correctly!

Leave your WordPress dashboard where it is and on another web browser instance (if you've been working in Chrome open Firefox or Edge)  Leave that browser session sitting on your homepage.

Finally, navigate back to Google Analytics browser page and on the left hand navigation panel you will see a collapseable section called 'Reports'. Click to expand that and then select 'Overview' from the sub menus.

You should see at least 1 active user being tracked in Google Analytics!

realtime visitor tracking in google analytics on wordpress

Successful Setup! Google Analytics tracking on WordPress

 

If you do, they your setup is working correctly.

Final thoughts

You've created a new web property in Google Analytics, installed and setup a WordPress plug-in and inserted your Google Analytics tracking code into your website to fire on every visit to your site.

If you're new to Google Analytics try clicking around your site to check that each page view registers in the 'Content' section. Also try navigating your site on different browsers or a device type such as a tablet. You could also explore the Real-time view by arriving at your site by clicking through a Google organic search or maybe a social media post you've done previously. These different sources will show in the 'Traffic Sources' view.

Ready to learn more? explore the Google Analytics learning Academy 

 

Subscribe to our mailing list

Sign-up to receive news and content items like this...

What Next:

Top 5 Benefits of Web Analytics [updated]

Introductory | [ARTICLE]

Our Top 5 Benefits of running web analytics on your website including key metrics and tips. Learn about key traffic metrics, visitor behaviour, conversions etc. [more...]

In this Guide:


How to setup Google Analytics on WordPress

  1. Google Analytics Property Setup
  2. Google Analytics Tracking Code
  3. Preparing WordPress
  4. Install Tracking Code
  5. Post Installation Checks
  6. Testing & Next Steps
advertisement

Related:


Benefits of Web Analytics
/benefits-of-web-analytics-for-small-businesses


What makes
NetConnective different?
  • Honest Advice
  • Simple Language
  • Affordable Pricing

advertisement

Do you need
Advice?

Free 30-Minute Consultation

Want to discuss this Setup Guide?

Posted in Guides, Setup and tagged , .