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.

If your site is built with HTML, you can either use your design software or the Editor in cPanel File Manager to edit your files.


While the basic instructions from Google Analytics state to paste the code before the closing </head> tag, you can actually insert it anywhere within your site (according to Google's support forum). It is recommended to place it as high in your code as possible. So, if you are using our Premium Website Builder to create your site, you can use the script module in Step 4 - Edit on each page where you wish to insert your code.

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:

Google Analytics for WordPress

Google Analytics Dashboard

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

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

Did you find this article helpful?


2012-12-17 4:43 am
Articles like this one that have several parts should be linked to one another.

Post a Comment

Email Address:
Phone Number:

Please note: Your name and comment will be displayed, but we will not show your email address.

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Need More Help?

Help Center Search

Current Customers

Email: Ticket: Submit a Support Ticket
Call: 877-595-4HUB (4482)
757-416-6627 (Intl.)
Chat: Click To Chat Now

Ask the Community

Get help with your questions from our community of like-minded hosting users and Web Hosting Hub Staff.

Not a Customer?

Get web hosting from a company that is here to help.