How to add Google Analytics to WordPress without a plugin (2015)

By | February 12, 2015

Introduction

Installing Google Analytics to your website allows you to track traffic to your website. You’ll be able to see how many visitors your site gets, and where they come from.

This might seem like a long article, but the process is actually really simple, and will only take a few minutes.

Obtaining your Google Analytics code

To add Google Analytics to your website, you’ll need to install your Google Analytics code to your website. First, you’ll need to obtain the analytics code for your website. There are three possible scenarios for this:

  • You don’t have a Google Analytics account at all; see ‘new analytics account
  • You have an Analytics account, and want to add another website to it; see ‘Existing analytics account, new website‘.
  • You have a Google Analytics account, and have added the website to it as a property, but still need to install the code to your WordPress website; see ‘Existing Analytics account, existing Analytics property

New Analytics account

Go to www.google.com/analytics, and click ‘Create an account’. Note that having an existing Google Account doesn’t mean you have an Analytics account by default, but you do need an existing Google account to sign up for Google Analytics.

 

Google-Analytics-sign-up

 

You’ll now see another that sums up the steps of getting started with Google Analytics. Just click the ‘Sign up’ once again.

Google-analytics-sign-up-3

You’ll now have to sign in with an existing Google account. Enter your account name and password and click ‘Sign in’.

Analytics-sign-up-2

You’ll be taken to a page where you have to fill out details about your new Google Analytics account.

Setting up your account

Account name: Use something that describes the potential group of websites that you’ll put in this ‘Account’. Note that you can have multiple ‘Accounts’ in your Google Analytics account. Confusing right? Example;  you can have an ‘Account’ for your own websites, in the case of our example ‘Joe’s Websites’. Let’s say Joe is a web developer who also builds websites for clients. He can now add another ‘Account’ for his clients; ‘Client websites’.

Setting up your property

  • Website name: Simply use the name of your website. As long as this will tell you which website this is, it’s good. You don’t have to add “http://www” or “.com / .net / etc”.
  • Website URL: Type out the web address, including the TLD (.com/.net, etc).
  • Industry Category: Use the drop-down menu to select the industry category that best describes your website.
  • Reporting time zone: Choose the time zone that you want to be used for your website. This time zone determines the 24 hour period that will be used to report your websites statistics.

Google-analytics-sign-up-4

Data sharing options

Google-Analytics-sign-up-5

Choose whether you want to share your analytics data, and with who. A detailed explanation is given. Uncheck the box, or boxes, to not share data.

Get your tracking ID

When you’ve filled out your account details and data sharing options, click the blue button that says ‘Get Tracking ID’.

Analytics-sign-up-6-get-tracking-ID

You’ll now be taken to a page where you’ll be given your Analytics tracking ID. Scroll down, and copy the tracking code.

Analytics-sign-up-7

 

Existing Analytics account, new website

With an excisting Analytics account, sign in, and click ‘Admin’ in the menu bar.

Google-Analytics-existing-account-new-website

This will take you to the admin page. Here, click the on the drop down menu below ‘property’, and click ‘Create new property’. The property in this case is your WordPress website.

Google-Analytics-Existing-Account-new-website-2

This will bring you to the ‘New Property’ page, where you’ll have to enter the same details and follow the same steps as mentioned in this article under ‘Setting up your property’.

Existing Analytics account, existing website property

If you have already added your website to an Analytics ‘Account’, go to the Admin page, and click ‘Tracking Info’.

Google-Analytics-existing-account-new-website

 

On the next page, scroll down to find your tracking code. Copy this code.

Adding the Analytics code to your WordPress website

The page containing your tracking code states ‘Add the Analytics code to every page you want to track’. WordPress makes this easy, as there are certain elements of your website that are loaded on every page or post, for instance the header and the footer of your website. In this example, we’re going to add the analytics code to the footer of the demo website.

Copy the Analytics code, and go to the dashboard of your WordPress website. Here, click ‘Appearance’, then ‘Editor’.

Installing-tracking-code-wordpress-1

 

Here, click ‘Footer’ to open the footer.php file. Paste your Google Analytics tracking code directly in front of the body html tag: </body>. Finally, click the ‘Update File’ button.

Installing-google-analytics-tracking-code-3

Done! You now have your Google Analytics tracking code installed.

Let’s see if it works!

You can immediately check if your Analytics code is installed correctly, by using a free tool on seositecheckup.com.

Go to seositecheckup.com, and add your website url to the box that says ‘Input Website URL’. Then select ‘Google Analytics Test’ from the dropdown menu, and click the green ‘Checkup!’-button.

Checking-the-code

If your Google Analytics code has been installed correctly, this tool will give you a score of 100/100:

Checking-the-code-3

Still having problems?

Somehow didn’t get this to work? Post a comment describing your problem and I’ll try to help you out.

2 thoughts on “How to add Google Analytics to WordPress without a plugin (2015)

  1. alina

    Seriously this tutorial is amazing….this is really what i m looking for.
    perfect job n thanks alot

    Reply
  2. bella

    I did everything, but at the end was no “UPLOAD FILE” button. I am missing something here?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

*