Skip links

How do I embed Google Analytics into a website?

Google Analytics is my favourite tool for analysing website performance and tracking key performance indicators.

Google Analytics is a great way to find out who visits your site, what they do while they’re on it and how long they stay. This powerful tool has many different functions.

See below for a step by step guide:

  1. Sign Up:

The first step to getting analytics working on WordPress is to sign up to Google Analytics. So visit Google.com/analytics. If you already have a Google account, then just click on access Google Analytics and sign in. If you don’t already have an account, you’ll need to create one.

  1. Add Your Details and Get Tracking ID

Next click sign up and fill in these details.

  1. First, you choose a website, if you’re using analytics on your website, then choose an account name.
  2. Enter a website name and your website address and select which industry your businesses is in.
  3. Then click on ‘get tracking ID’. If you agree to the Terms then click on agree.

You are now presented with a screen that may look confusing. Don’t worry as you only need the Google Analytics tracking ID.

This is important so make a note of this. We will be using this tracking ID in a moment to link our WordPress website to our Google Analytics account.

  1. Embed your Google Analytics

Your tracking ID should look like something along the lines of UA-62701241-1. There are a few ways you can embed your tracking code into your website. The preferred method is placing the code in the head element of your template. To embed your tracking code, you must include everything that starts with <script> and ends with </script>.

Another method of embedding, is to use a plugin. There are many out there. We recommend the Yoast Google Analytics plugin.

To install this plugin visit the ‘plugins’ section in your WordPress dashboard.

Once installed and activated, you’ll see the analytics icon on the left. Click on dashboard and click the link to start linking your Google Analytics account with your WordPress website.

Join the Discussion