Google Analytics Events

This article explains how to use auto-event tracking to generate Google Analytics events

If auto-event tracking does not meet the needs of your scenario, you can manually trigger events from your code.

Clicks on Links

Let's say that every page on your site has a navigation menu that allows you to go to the "Buy" page, the "About" page, or the "Contact" page, depending upon which navigation item is selected. The "Buy" selection links to "http://example.com/buy.html". "About" links to "http://example.com/about.html". "Contact" links to "http://example.com/contact.html". You want to generate a Google Analytics event each time someone clicks one of these navigation items.

  1. Add a basic page tracking tag (i.e. Tag Type of Google Analytics or Universal Analytics; Track Type of Page View) if you don't already have one. This tag must fire on all pages.
  2. Add a tag of type Event Listener > Link Click Listener. You can name it “Link Click Listener”. Add a single firing rule of "All pages".
  3. Add a rule for each link that you want to track. For example, for the http://example.com/buy.html link, create a rule named "Buy Clicks" and enter the following conditions:
    {{event}} equals gtm.linkClick
    {{element url}} contains buy.html
  4. For each link, add an Analytics event tracking tag (i.e. Tag Type of Google Analytics or Universal Analytics; Track Type of Event) and name it after the link you are tracking (for example, "Analytics Event - Buy"). Add the rule you created in the previous step as the firing rule (for example, "Buy Clicks"). Enter a Category, Action, and and Label for the event. For example, you might use the following for the "Buy" navigation link:
    • Category "Nav"
    • Action "Select"
    • Label "Buy".
  5. Save a version of the container and publish it.

All Clicks

  1. Add a basic page tracking tag (i.e. Tag Type of Google Analytics or Universal Analytics; Track Type of Page View) if you don't already have one. This tag must fire on all pages.
  2. Add a tag of type Event Listener > Click Listener. You can name it “Click Listener”. Add a single firing rule of "All pages".
  3. Add a rule (named "All Clicks" for example) with the following condition:
    {{event}} equals gtm.click
  4. Add an Analytics event tracking tag (i.e. Tag Type of Google Analytics or Universal Analytics; Track Type of Event). Add the rule you created in the previous step as the firing rule (for example, "All Clicks"). Enter a Category, Action, and and Label for the event. For example, you might use the following:
    • Category "All"
    • Action "Click"
    • Label "All".
  5. Save a version of the container and publish it.

Timed Intervals

  1. Add a basic page tracking tag (i.e. Tag Type of Google Analytics or Universal Analytics; Track Type of Page View) if you don't already have one. This tag must fire on all pages.
  2. Add a tag of type Event Listener > Timer Listener. If you want to generate an event every ten seconds, you might name it “Timer Listener 10”.
    1. Enter a name in the Event Name field. You can provide any name you want. If you enter, for example, "timer10", you would then check for it, when defining rules, using "{{event}} equals timer10".
    2. Enter your desired interval in milliseconds. (For example, 10000 will generate an event every 10 seconds.)
    3. Add a single firing rule of "All pages".
  3. Add a rule (named "Timer 10" for example) that checks for the Event Name you created in the previous step: {{event}} equals timer10
  4. Add an Analytics event tracking tag (i.e. Tag Type of Google Analytics or Universal Analytics; Track Type of Event). Add the rule you created in the previous step as the firing rule (for example, "Timer 10"). Enter a Category, Action, and and Label for the event.
  5. Save a version of the container and publish it.

Form Submit

  1. Add a basic page tracking tag (i.e. Tag Type of Google Analytics or Universal Analytics; Track Type of Page View) if you don't already have one. This tag must fire on all pages.
  2. Add a tag of type Event Listener > Form Submit Listener. You can name it “Form Submit Listener”. Add a single firing rule of "All pages", or, for the specific page(s) on which you want to listen for form submissions.
  3. Add a rule (named "Form Submit" for example) with the following condition:
    {{event}} equals gtm.formSubmit
  4. Add an Analytics event tracking tag (i.e. Tag Type of Google Analytics or Universal Analytics; Track Type of Event). Add the rule you created in the previous step as the firing rule (for example, "Form Submit"). Enter a Category, Action, and and Label for the event. For example, you might use the following:
    • Category "Forms"
    • Action "Submit"
    • Label "Lead Gen".
  5. Save a version of the container and publish it.