[UA] Set up the Analytics Google tag [Legacy]

You are viewing a legacy article about Universal Analytics. Learn more about Google Analytics 4 replacing Universal Analytics.

In this article:

Basic instructions

  1. If you have not already done so, create a Universal Analytics property for each website you want to collect data from.

    Creating a property generates a unique Tracking ID and the Google tag that includes the Tracking ID for that property. See the following section for information about finding your Tracking ID and the Google tag.
  2. Copy and paste the Google tag after the opening <head> tag on each page you want to measure.

Find your Tracking ID and Google tag

  1. Sign in to your Analytics account.
  2. Click Admin.
  3. Select an account from the menu in the ACCOUNT column.
  4. Select a property from the menu in the PROPERTY column.
  5. Under PROPERTY, click Tracking Info > Tracking Code.

    Your Tracking ID is displayed at the top of the page.

    Your Google tag is displayed farther down the page in a text box under Website Tracking > Google tag (gtag.js)

The Google tag

The Google tag is several lines of code that you need to paste into each webpage you want to measure:

<!-- Google tag (gtag.js) -->

... (several lines of code) ...

</script>

To add the Google tag to your webpages:

  1. Copy the entire contents of the text box.
  2. Paste it after the opening <head> tag on each page you want to measure.

Set up data collection based on your type of site

The method of collecting data in Analytics varies depending on the type of website you use:

Verify that your Google tag is working

To verify that the tag is working, visit your website, and then check the Real-Time reports in Analytics to verify that your visit was registered.

You can also use Google Tag Assistant to determine whether your tag is implemented correctly.

Download Tag Assistant | Learn more about using Tag Assistant

gtag.js Developer Guide

Was this helpful?

How can we improve it?
true
Choose your own learning path

Check out google.com/analytics/learn, a new resource to help you get the most out of Google Analytics 4. The new website includes videos, articles, and guided flows, and provides links to the Google Analytics Discord, Blog, YouTube channel, and GitHub repository.

Start learning today!

14703523729001417938
true
Search Help Center
true
true
true
true
true
69256
Search
Clear search
Close search
Main menu
true
false
false