Notification

G Suite is now Google Workspace: everything your business needs to get work done.

[UA] Universal Analytics events [Legacy]

You are viewing a legacy article about Universal Analytics. Learn more about Google Analytics 4 replacing Universal Analytics.
Note: This article is about Universal Analytics (UA). Starting July 1, 2023, standard UA properties will stop processing data (July 1, 2024 for UA 360 properties). If you are still using UA, make the switch to Google Analytics 4 (GA4).

Google Tag Manager uses trigger configurations to fire tags in response to events. This article explains how to use Tag Manager to set up Universal Analytics event tags that are triggered in response to clicks on links, clicks on other types of elements, at timed intervals, and when a forms are submitted.

This article describes how to configure Tag Manager to create triggers that listen for certain types of events that are expected to occur on a web page. For more precise control of your trigger functionality, set up your code to use triggers based on events pushed to the data layer.

There are two common methods shown here for how to send click event information to Google Analytics:

For these examples, we will assume that a web page contains a navigation menu with these link names and URLs:

Buy https://example.com/buy.html
About https://example.com/about.html
Contact https://example.com/contact.html

Use separate triggers and tags to measure clicks

This method requires the creation of three triggers and three tags - one trigger/tag pair for each item in the table above:

  1. Add a Google Analytics pageview tag if one does not already exist. This tag must fire on all pages.
  2. Enable Tag Manager to capture clicked URL data:
    1. Click Variables.
    2. In the Built-In Variables section, click Configure.
    3. Enable the checkbox for Click URL.
  3. Create triggers that listen for link clicks for buy.html, contact.html, and about.html:
    1. Click Triggers and then New.
    2. Click Trigger Configuration and then Click - Just Links.
    3. Add these settings to the trigger configuration:
      • Wait for tags: Enable
      • Max wait time: 2000 (milliseconds)
      • Check Validation: Disable
      • Enable this trigger when all of these conditions are true: Page URL and then contains and then /
      • This trigger fires on: Some Link Clicks and then Click URL and then contains and then buy.html
      • Name the trigger “Trigger - Buy Clicks” and save the trigger.
    4. Repeat these steps for “contact.html” and “about.html
  4. Create three new Google Analytics tags to measure clicks for each page:
    1. Click Tags and then New.
    2. Click Tag Configuration and then Google Analytics - Universal Analytics.
    3. Set Track Type to Event.
    4. Enter Event Tracking Parameters:
      • Category: Nav
      • Action: Select
      • Label: Buy
        NOTE: The Label value should correspond to the particular link being clicked (e.g. "Buy" for buy.html, "Contact" for contact.html, and "About" for about.html).
      • Tag Name: UA - Event - Buy Link
      • Non-Interaction Hit: False
      • Google Analytics Settings: Select an existing Google Analytics Settings variable, or create a new one.
    5. Click Triggering and select the trigger that you created in step 3, titled "Trigger - Buy Clicks".
    6. Give the tag a name and save the tag configuration.
  5. Repeat these steps to create tags for the Contact and About links. Remember to set the Label value according to the name of the page, e.g. "Buy" for buy.html, "Contact" for contact.html, and "About" for about.html
  6. Publish the container.

Use a single tag to measure clicks

You can simplify your container with a single trigger that uses a regular expression to fire on the correct pages, and a single tag that uses a Tag Manager variable for the Label field:

  1. Add a Google Analytics pageview tag if one does not already exist. This tag must fire on all pages.
  2. Enable Tag Manager to capture clicked URL values:
    1. Click Variables.
    2. In the Built-In Variables section, click Configure.
    3. Select the Click URL built-in variable.
  3. Create a single trigger to handle link clicks for each item in the table above:
    1. Click Triggers and then New.
    2. Click Trigger Configuration and then Click - Just Links
    3. Configure the trigger with these settings:
      • Wait for tags: Enable
      • Max wait time: 2000ms
      • Check Validation: Disable
      • Enable this trigger when all of these conditions are true: Page URL and then contains and then /
      • This trigger fires on: Some Clicks and then Click URL and then matches RegEx and then contact\.html|buy\.html|about\.html
    4. Name the trigger “Trigger - Nav Clicks” and save.
  4. Create a single Tag to handle all clicks:
    1. Click Tags and then New.
    2. Click Tag Configuration and then Google Analytics - Universal Analytics.
    3. Set Track Type to Event.
    4. Complete the Event Tracking Parameters:
      • Category: Nav
      • Action: Select
      • Label: {{Click URL}}
    5. Click Triggering and select the trigger that you created in step 3, titled “Trigger - Nav Clicks”.
    6. Save the tag.
  5. Publish the container.

Clicks on any element

Use this technique to measure clicks on elements other than links. This includes clicks on images, <div> elements, or any other item on the page accessible by the DOM. For this example, each image has a class attribute value of gallery and a unique ID attribute value for each image:

<a href="ggb.jpg" class="gallery" id="Golden_Gate_Bridge">
<a href="tm.jpg" class="gallery" id="Taj_Mahal">

In this example, we use these attributes to configure a trigger that fires on image tags with class="gallery", and use that trigger to fire a tag that sends the respective ID values (e.g. Golden_Gate_Bridge, Taj_Mahal) to Google Analytics:

  1. Add a Google Analytics pageview tag if one does not already exist. This tag must fire on all pages.
  2. Enable Tag Manager to capture clicked class and ID values:
    1. Click Variables.
    2. In the Built-In Variables section, click Configure.
    3. Select the Click Classes and Click ID built-in variables.
  3. Create a new trigger that fires when a link has a class attribute value of gallery:
    1. Click Triggers and then New.
    2. Click Trigger Configuration and thenClick - All Elements.
    3. Enable this trigger when all of these conditions are true: Page URL and then contains and then /
    4. This trigger fires on: Some Clicks and then Click Classes and then contains and then gallery.
    5. Save the trigger and name it "Trigger - Gallery Image Click" when prompted.
  4. Create a tag to capture the ID attribute values for a clicked image:
    1. Click Tags and then New.
    2. Click Tag Configuration and then Universal Analytics.
    3. Set Track Type to Event.
    4. Complete the Event Tracking Parameters:
      • Category: Image Gallery
      • Action: Click
      • Label: {{Click ID}}
        Note: the curly braces are used in text fields and custom code to replace a valid Tag Manager variable name with the relevant value retrieved from the event.
      • Non-Interaction Hit: False
      • Google Analytics Settings: Select an existing Google Analytics Settings variable, or create a new one if necessary.
    5. Click Triggering and select the trigger that you created in step 3, titled "Trigger - Gallery Image Click".
    6. Save the tag as "GA - Event Tag - Gallery Image Click".
  5. Publish the container.

Timed intervals

Implementation of timed interval tags may influence bounce rate reports such that the numbers may appear lower than expected.

Measure timed intervals when you need to understand time on page when no events are triggered. This might include users who read text or play video on the page. Additionally, given that Google Analytics sessions timeout after 30 minutes by default, you may wish to implement a ‘keepalive event’ to ensure that an activity is sent every 25 minutes.

To configure a tag that measures timed intervals:

  1. Add a basic Google Analytics pageview tag if one does not already exist. This tag must fire on all pages.
  2. Create a Timer Trigger:
    1. Click Triggers and then New.
    2. Click Trigger Configuration and then Timer.
    3. Add these settings to the trigger configuration:
      • Event Name: gtm.timer
      • Interval: 1500000 (calculated in milliseconds)
      • Limit: 5
      • Enable this trigger when all of these conditions are true: Page URL and then contains and then video.html
      • This trigger fires on: All Timers
    4. Save the Trigger as “Trigger - Session Timer"
  3. Create a session timer tag:
    1. Click Tags and then New.
    2. Click Tag Configuration and then Universal Analytics and add these settings to the tag configuration:
      • Track type: Timing
      • User Timing Tracking Parameters: Leave blank or add values as desired for your reports.
    3. Click Triggering and select the trigger that you created in step 2, titled “Trigger - Session Timer”.
  4. Publish the container.

Form submits

This technique will cause a tag to fire every time a form on a web page is submitted. This example assumes the <form> HTML tag contains an ID attribute with a value of "contact_us":

<form action="/example" method="POST" id="contact_us">

We can use this ID to create a trigger that will listen for when this form is submitted:

  1. Add a basic Google Analytics pageview tag if one does not already exist. This tag must fire on all pages.
  2. Enable Tag Manager to capture form IDs:
    • Click Variables.
    • Click Configure in the Built-In Variables section.
    • Select the Form ID built-in variable.
  3. Create a form submit trigger:
    • Click Triggers and then New.
    • Click Trigger Configuration and then Form Submission.
    • Add these settings to the trigger configuration:
      • Wait for Tags: Disable
      • Check Validation: Enable
      • Enable this trigger when all of these conditions are true: Page URL and then contains and then /
      • This trigger fires on: Some Forms and then Form ID and then contains and then contact_us
    • Save the trigger as “Trigger - My Form Submits”.
  4. Create the tag to measure form submits:
    1. Click Tags and then New.
    2. Click Tag Configuration and then Universal Analytics.
    3. Set Track Type to Event.
    4. Fill in the Event Tracking Parameters:
      • Category: Forms
      • Action: Submit
      • Label: Lead Gen - {{Form ID}}
        Note: the curly braces are used in text fields and custom code to replace a valid Tag Manager variable name with the relevant value retrieved from the event.
    5. Non-Interaction Hit: False
    6. Google Analytics Settings: Select an existing Google Analytics Settings variable, or create a new one.
    7. Click Triggering and select the trigger that you created in step 3, titled “Trigger - My Form Submits”.
    8. Save the tag as "GA - Event Tag - Form Submits".
  5. Publish the container.

Related resources

Was this helpful?

How can we improve it?
Search
Clear search
Close search
Google apps
Main menu
14681299752968004946
true
Search Help Center
true
true
true
true
true
102259
false
false