Google Analytics  «Prev  Next»

Installing Tracking Code

Get started with Google Analytics in three simple steps.

First, sign up for a Google Analytics Account. Second, install the provided code across all pages of your site. Third, if you are using Google AdWords, link it to your Google Analytics account to report on cost and click data.

Create a New Account

There are two places you can sign up for a Google Analytics account. You can go to google.com/analytics and click the Sign up now link. Or, if you are already an AdWords user, you can create a new account via Google Analytics under Reporting.

JavaScript and First Party Cookies

Google Analytics uses a combination of JavaScript and first party cookies to gather anonymous data about your visitors.
As you set up your Google Analytics account, you will be provided with a tracking code. You will need to install this tracking code across all pages of your site.

Finding your Tracking Code

If you need to access your tracking code later on, you can find it by going to Analytics Settings, and clicking Edit next to the profile. You will be taken to the profile settings page.
Click the Check Status link in the top right corner to be taken to the page that contains your tracking code and brief instructions for how to install it.
This page gives you the asynchronous version of the Google Analytics Tracking Code. The asynchronous version of the tracking code allows your site to run at its fastest, so we recommend that you always use this version. Throughout this course, we use the asynchronous tracking code whenever we illustrate a tracking technique. Traditional ga.js tracking is still used on many sites.
To see the traditional ga.js syntax, navigate to the URL shown on the slide.
Be sure to replace the "x"s in the code with your unique Google Analytics

Understanding the Tracking Code

Let us look at the tracking code. This section of the code tells Google Analytics which account this traffic belongs to. The number immediately following the UA dash is your unique Google Analytics account number, and the number following the last dash is the property index. Review the lesson on accounts and profiles to learn about the property index. This section of the tracking code automatically detects secure versus non-secure pages. So, you can use the same tracking code on both https and http pages.