Universal Analytics events

Google Tag Manager uses trigger configurations to fire tags in response to events. This commodity explains how to use Tag Manager to set up Universal Analytics result 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 Director 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, fix your lawmaking to use triggers based on events pushed to the data layer.

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

  • Utilize a separate trigger and tag for each blazon of link.
  • Use a single tag with a regular expression to handle all click data.

For these examples, we volition assume that a spider web folio contains a navigation menu with these link names and URLs:

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

Employ separate triggers and tags to measure clicks

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

  1. Add a Google Analytics pageview tag if ane does not already exist. This tag must burn down 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 almost.html:
    1. Click Triggers and then New.
    2. Click Trigger Configuration and then Click - Just Links.
    3. Add these settings to the trigger configuration:
    4. Repeat these steps for "contact.html" and "nearly.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 Blazon to Upshot.
    4. Enter Event Tracking Parameters:
      • Category: Nav
      • Action: Select
      • Label: Buy
        Annotation: The Label value should correspond to the particular link beingness clicked (e.m. "Buy" for buy.html, "Contact" for contact.html, and "Most" for most.html).
      • Tag Proper name: UA - Event - Buy Link
      • Non-Interaction Striking: False
      • Google Analytics Settings: Select an existing Google Analytics Settings variable, or create a new i.
    5. Click Triggering and select the trigger that you created in step iii, titled "Trigger - Buy Clicks".
    6. Give the tag a proper name and save the tag configuration.
  5. Echo these steps to create tags for the Contact and Most links. Remember to set the Label value according to the proper name of the page, e.grand. "Purchase" for purchase.html, "Contact" for contact.html, and "Almost" for well-nigh.html
  6. Publish the container.

Utilise a unmarried tag to measure clicks

You can simplify your container with a single trigger that uses a regular expression to burn 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 Director 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 tabular array above:
    1. Click Triggers and then New.
    2. Click Trigger Configuration and then Click - Just Links
    3. Configure the trigger with these settings:
    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 Upshot Tracking Parameters:
      • Category: Nav
      • Action: Select
      • Label: {{Click URL}}
    5. Click Triggering and select the trigger that you created in stride three, titled "Trigger - Nav Clicks".
    6. Save the tag.
  5. Publish the container.

Clicks on any element

Employ this technique to mensurate clicks on elements other than links. This includes clicks on images, <div> elements, or any other detail on the folio accessible by the DOM. For this example, each prototype 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 instance, we use these attributes to configure a trigger that fires on image tags with class="gallery", and utilise that trigger to burn a tag that sends the corresponding ID values (e.g. Golden_Gate_Bridge , Taj_Mahal ) to Google Analytics:

  1. Add a Google Analytics pageview tag if 1 does non already be. This tag must fire on all pages.
  2. Enable Tag Manager to capture clicked class and ID values:
    1. Click Variables.
    2. In the Congenital-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 then Click - All Elements .
    3. Enable this trigger when all of these conditions are truthful: Folio 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 information technology "Trigger - Gallery Paradigm Click" when prompted.
  4. Create a tag to capture the ID attribute values for a clicked epitome:
    1. Click Tags and then New.
    2. Click Tag Configuration and then Universal Analytics.
    3. Set Track Type to Event.
    4. Consummate 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 Director variable name with the relevant value retrieved from the effect.
      • Non-Interaction Striking: False
      • Google Analytics Settings: Select an existing Google Analytics Settings variable, or create a new ane if necessary.
    5. Click Triggering and select the trigger that you created in step three, titled "Trigger - Gallery Prototype Click".
    6. Save the tag as "GA - Outcome Tag - Gallery Paradigm 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 action is sent every 25 minutes.

To configure a tag that measures timed intervals:

  1. Add together a bones Google Analytics pageview tag if one does non already be. 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:
    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 blazon: Timing
      • User Timing Tracking Parameters: Leave blank or add together values as desired for your reports.
    3. Click Triggering and select the trigger that yous created in step two, titled "Trigger - Session Timer".
  4. Publish the container.

Form submits

This technique will cause a tag to burn down every fourth dimension a form on a web page is submitted. This instance assumes the <form> HTML tag contains an ID attribute with a value of "contact_us":

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

Nosotros can use this ID to create a trigger that volition mind for when this form is submitted:

  1. Add a bones Google Analytics pageview tag if one does not already be. This tag must fire on all pages.
  2. Enable Tag Manager to capture form IDs:
    • Click Variables.
    • Click Configure in the Born Variables section.
    • Select the Form ID built-in variable.
  3. Create a course submit trigger:
  4. Create the tag to measure form submits:
    1. Click Tags and then New.
    2. Click Tag Configuration and then Universal Analytics.
    3. Set up Track Type to Effect.
    4. Fill in the Event Tracking Parameters:
      • Category: Forms
      • Action: Submit
      • Characterization: Lead Gen - {{Course 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 outcome.
    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 lot created in step 3, titled "Trigger - My Grade Submits".
    8. Save the tag as "GA - Outcome Tag - Course Submits".
  5. Publish the container.

Related resource

  • Deploy Google Analytics with Tag Managing director
  • Google Analytics custom dimensions
  • Google Analytics Content Groups
  • Measurement with user IDs
  • Google Analytics ecommerce
  • Measure user activity beyond domains
  • Google Analytics dynamic remarketing
  • Google Analytics help center: About Google Analytics events

Was this helpful?

How can we improve it?