How to Install Google Analytics on Your Site

In our previous article we covered the initial setup for Google Analytics. In this article we'll cover implementing Google Analytics for your website. If you have not yet signed up for Google Analytics, please review our previous article for step-by-step instructions.

Obtaining the Google Analytics Tracking Code

Let's pick up where we left off in our previous article. We've signed up for and logged into our Google Analytics account. If you're not already on the Tracking Code screen, click on the gear icon in the upper right area of the screen to take you into the management area and then click on the "Tracking Code" tab.

For our purposes, we will be installing Google Analytics on a single domain. If your site has subdomains or multiple top-level domains you want to install this for, make the needed selection in Step 1 of this screen. You can also setup separate profiles for separate sites.

Scrolling down, in Step 2 you'll see code to be copied and pasted into your site's files.

Once you've copied your code, click the Save button at the bottom of this screen.

You may want to bring up a text editor (such as Notepad or TextEdit) and paste the code in there while you work through the steps to bring up your site files for editing.

Inserting the Google Analytics Code into your Site

How you insert the code will depend on how you build your site. Keep in mind that you will need to insert the code into every page you wish to track with Google Analytics.

If you are dynamically creating page headers (with PHP for instance) you will want to place the code into the files called to create your headers.

Inserting Google Analytics Code into a WordPress Site

While you can manually insert the Google Analytics code into WordPress files (footer or functions files) we recommend using a plugin since code pasted into theme files could be overwritten by theme updates and would not automatically be copied over to their respective files if you switched themes.

You can search WordPress plugins for Google Analytics and review the various results. Two of the most popular and highly rated plugins are:

Testing Google Analytics Installation

To test your installation of Google Analytics, you can check the status from your Google Analytics account. You can easily change from the beta view to the classic view by clicking on the "Old View" link in the upper right of your screen in Google Analytics. Once in the classic view, you should see a clock (tracking installed) or a green check mark once you have reports to view for your site.

Once you have inserted the code for each of your pages you wish to track, you can begin using your Google Analytics Account to track your website traffic.

Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)

The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.

How did you find this article?

Please tell us how we can improve this article:

Email Address

Name

new! - Enter your name and email address above and we will post your feedback in the comments on this page!