Follow these instructions to collect basic page tracking data from a website. Once you have successfully installed basic page tracking on your site, you'll see data in most of your Analytics reports, including traffic referral information, user characteristics and browsing information. It may take 24 hours for data to appear in your reports once tracking has been installed.In this article:
Decide how to add tracking
There are two ways to collect page tracking data:
- Add the Analytics tag (Universal Analytics) to your website container using Google Tag Manager. This approach is recommended because using Google Tag Manager simplifies tag management on your site. Using Google Tag Manager makes it easier to add other tags (such as AdWords Conversion Tracking and remarketing tags) to your site and configure your Analytics tracking.
- Add the tracking code directly into the HTML of every page of your website. This is the easiest approach if you only want to add the basic Analytics tracking code to your site.
Add tracking using Google Tag Manager
If you are unfamiliar with Google Tag Manager, begin by reading About Google Tag Manager. Once you're ready to set up a Google Tag Manager account and set up Google Tag Manager on your site, read Setup and Workflow (Web).
To add Analytics tracking to your site, add the Analytics tag to your container in Google Tag Manager and publish the container.
Add the tracking code directly to your site
To complete this process, you must have access to your website source code, be comfortable editing HTML (or have a webmaster/developer who can help you) and have an Analytics account and property already set up.
To set up the web tracking code:
- Find the tracking code snippet for your property.
Sign in to your Analytics account, and select the Admin tab. From the ACCOUNT and PROPERTY columns, select the property that you’re working with. Click Tracking Info > Tracking Code. Click to expand this image and see where these options appear in the interface.
<script>and ends with
The tracking code contains a unique ID that corresponds to each Analytics property. Don’t mix up tracking code snippets from different properties and don’t reuse the same tracking code snippet on multiple domains.
- Copy the snippet.
Don’t edit your snippet. Just copy it. You might want to paste it into a text document if you’re worried about accidentally losing or changing the snippet from your clipboard.
- Paste your snippet (unaltered, in its entirety) into every web page that you want to track. Paste it immediately before the closing
If you use templates to dynamically generate pages for your site (like if you use PHP, ASP or a similar technology), you can paste the tracking code snippet into its own file, then include it in your page header.
- Check your setup.
Make sure that the tracking snippet installed on your website matches the code shown in the view, and see more ways that you can verify your setup.
Refer to Introduction to analytics.js to learn more about Analytics tracking code.
Refer to the Analytics (Universal Analytics) tag if you use Google Tag Manager to manage your Analytics tracking.