Google Analytics Tracking Code – Get started with Google Analytics in three simple steps.
In this lesson, you will learn: Where to place the Google Analytics Tracking Code. About website setups that require customization and how to verify your installation.
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.
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.
Google Analytics javascript
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’ll need to install this tracking code across all pages of your site. f you need to access your tracking code later on, click the account administration icon at the top right of your screen.
On the Account Administration screen, you’ll see a table listing the accounts to which you have access. Click the account that contains the web property you’re interested in. You’ll then see a table listing all the web properties for that account. Click the desired web property.
On the next page, click the Tracking Code tab. 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 account number and property index, which will be explained in the next slide.
The tracking 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.
The tracking code that is provided to you is designed to work with most site setups. In some cases, however, you’ll need to make small updates to the tracking code on each of your pages. For example, if you need to: Track multiple domains in one profile. Track more than one subdomain per profile, or track multiple domain aliases, you should review the module on tracking domains and subdomains — and customize your code before adding it to your pages.
Installing the Google tracking code
To install the JavaScript, copy your tracking code–either the code provided during setup, or your customized snippet–and paste it into your page.
One of the main advantages of the asynchronous snippet is that you can position it at the top of the HTML document. This increases the likelihood that the tracking beacon will be sent before the user leaves the page. It is customary to place JavaScript code in the
section, and we recommend placing the snippet at the bottom of the section for best performance. To maintain tracking consistency, it is important that the code is installed across all pages of your site.Once you’ve installed your tracking code, it usually takes about 24 hours for data to appear in your reports. The best way to verify that you are receiving data is to simply look at your reports. You can also view your webpage’s source code to verify that the tracking code is installed. Navigate your browser to any page on your site. Right click within the browser window and select the “View Page Source” or “View Source” option in your browser. This will open a new window that contains the source code for that page. Now search for ga.js. (From the source code menu, select “Edit” and click the “Find” option.) If you find the Google Analytics tracking code on your page, then it is likely that Google Analytics has been successfully installed on your site. Repeat this process across several pages on your site to make sure that your installation is complete.
Recent Comments