Notification

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

[UA] Universal Analytics events

Note: This article is about Universal Analytics (UA). UA will stop sending data from 1 July 2023.  If you're 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 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 doesn't 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 tick box 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 waiting time: 2,000 (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 doesn't 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 waiting time: 2,000ms
      • 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 doesn't 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 brackets 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 time out 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 doesn't 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: 1,500,000 (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 that 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 doesn't 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 brackets 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
12265088723688847509
true
Search Help Centre
true
true
true
true
true
102259
false
false