Google Tag Manager V2 Triggers: What You Need To Know

Google Tag Manager Version 2 Triggers: What You Need To Know

/

blog-gtm-v2-triggers
Monday, March 30th, Google officially released a timeline for migrating Google Tag Manager Accounts from version 1 of the interface to version 2 (Or v1 and v2 for short). Version 1 users will have until June 1st to manually opt in to upgrading to the v2 interface. Starting June 1st, Accounts not yet in the v2 interface will be automatically migrated.

For more on what to expect in terms of the migration, check out the official documentation on the upgrade or Simo Ahava’s blog on the migration process. If you’d like to learn more about all of the changes in v2, refer to Jonathan Weber’s post on the subject.

One of the biggest changes in the v2 interface is the transformation of Rules into Triggers. Like Rules, Triggers dictate when tags are ‘fired’ from our container. Similarly to Rules, Triggers can have one or many conditions on which to fire, but unlike Rules, all Triggers require you to start by choosing an event.

Link and Form Triggers also have an additional Enable When configuration that dictates when the Trigger is active.

Luckily, the new version also comes with an eye-pleasing ‘wizard’ interface that will help guide you through the process. To illustrate these changes, let’s step through creating a new Trigger in the interface.

Step One: Choose Event

In the v1 interface, Rules had to have firing conditions. One condition frequently used was {{event}} equals foo, where foo was gtm.click, gtm.formSubmit, etc. If a Rule didn’t have an {{event}} condition specified, it would try and fire as soon as the page loaded.

In v2, this is no longer the case; every Trigger requires an event condition. They make this obvious by forcing the selection of an event as the very first step in the Trigger creation process.

Screen Shot 2015-04-07 at 3.17.50 PM

Here’s a quick overview of how each Trigger event type works:

  • Page View: Has three flavors: The default fires as soon as GTM is loaded, but it can be set to fire when the DOM is ready or the window load event has fired; use this Trigger event for anything you’d like to fire as soon as possible
  • Click: Has two flavors: Link Click and Click. Use this when you’d like a Trigger to fire when a user clicks on a link or other on-page element, except for form submissions.
  • Form: Fires the Trigger when a user submits a Form. Use this when you want you Trigger to fire when a user submits a contact us or lead generation form.
  • History Change: Fires the Trigger when the URL changes and the page is not reloaded. You might use this Trigger when you want to fire a pageview when the view changes in an Angular application or a modal opens.
  • Custom Event: Fires the Trigger when an event you indicate is pushed to the Data Layer. Use this Trigger when you want to fire a tag with an event you create and push into the Data Layer object, like this: {'event':'youTubeTrack'}. Accepts RegEx matches.
  • JavaScript Error: Fires the Trigger when a script executing on the browser throws an uncaught error. Use this Trigger when you want to fire Google Analytics Events when a JavaScript error occurs.
  • Timer: Fires the Trigger on a set interval of time, like every three seconds, up to an optional limit. Use this trigger to fire a Google Analytics interaction event to exclude users who spend more than sixty seconds on the page from your bounce rate.

Many of these event types should feel familiar. In v1, we used Listeners in order to capture most of these events; v2 bakes them into the Trigger workflow. If you migrate a v1 Account, you will still see Listeners in your container but you eventually should switch to using the new Trigger method instead.

Step Two: Configure Trigger

Once you have selected a Trigger event, you will need to configure certain conditions and properties of the event. This is where you can specify specific variations of the Trigger event type you’ve selected. For example, you can change the Pageview Trigger event to fire when the DOM is ready, or the specify that the Click event you want occurs on Just Links (a-type elements) or All Elements.

This is also where you specify if you want your Trigger to do special things, like only fire when all of the form fields on the page pass validation, or delay loading the next page a specified length of time so that your tags have time to fire. If you select either the Click -> Just Links or Form Trigger event, an additional step will appear.

Step Three: Enable When

Note: This additional configuration option will only appear for Link or Form Triggers.

If you selected the Form or Link Click Trigger event type and checked either Wait for Tags or Enable Validation, you’ll need to add an Enable When condition.

This is different then your firing condition. The Enable When condition allows you to specify when you do or do not want the Trigger to be available. This is useful because configurations like Wait For Tags occasionally cause conflicts with other on-page code. The Enable When condition forces you be surgical with your Triggers; when possible test your Triggers using the Preview tool in multiple browsers.

Screen Shot 2015-04-07 at 4.25.09 PM

For instance, if you’d like to track PDF downloads and want to look for PDFs on any page on your site, set Enable When to {{Page URL}} matches RegEx .*.

Screen Shot 2015-04-07 at 4.25.30 PM

Step Four: Fire On

When you’ve finished configuring your tag, it’s time to add your Fire On conditions. These are very similar to the Firing Rules of v1, except now the {{event}} condition is already taken care of for us.

Just like in v1, every condition you add to your Trigger must be met in order for your Trigger to fire. A Trigger with Fire On conditions {{Page URL}} equals /receipt and {{Page URL}} equals /thank-you will never fire; you must either use RegEx to match multiple conditions or create additional Triggers for each condition you’d like your Trigger to fire on.

Screen Shot 2015-04-07 at 4.30.23 PM

Recap

And that’s all there is to it! While it may be an adjustment to go from Version 1 to Version 2, it certainly clarifies a few points and makes the steps to creating new Triggers very clear.

Remember that every time you want to create a Trigger, even a Blocking Trigger, it has to be associated with an event. You can use the Custom Event type with the expression .* in order to make the Trigger available on any event.

Use the Check Validation and Wait For Tags configurations with caution, and remember that Link and Form event Triggers require an enabling rule.

Finally, remember that all of your Fire On conditions must be met in order for the Trigger to fire. You can inspect which conditions were or were not met using the Debug Panel.

Advanced Troubleshooting Tips

Migrating to this new workflow is tough; some terminology will feel unfamiliar, and the Trigger creation wizard can be confusing. Here are some tips and common gotchas that we’ve seen:

Inspect the Tag inside the Debug Panel

If you can’t figure out why your tag isn’t firing, check the GTM Debug Panel in Preview Mode. On the left side of the panel, click on the Event that you expect your tag to fire on, then scroll to the bottom of the tag. Here, you’ll see the Triggers that fire that tag, as well as which Trigger Fire On conditions were or were not met during that Event.

Screen Shot 2015-04-07 at 4.43.57 PM

No gtm.formSubmit, gtm.click, Or gtm.linkClick Event Appearing

Check that you have an appropriate Trigger created and that it is set to fire on that particular page. This goes back to the Enable When condition that tells Google Tag Manager where to listen for Forms and Clicks.

If you still do not see the events showing up in the Data Layer, verify that the Data Layer is not being overwritten further down the page in the on-page code.

gtm.click Appears Instead Of gtm.linkClick

Check that you selected the All Links option inside the configuration settings for your Click Trigger.

If you’re still having issues, check that there is no code on the page calling return false;, event.preventDefault(), or event.stopPropagation() in a click handler on the element. A good way to track this down is to use the Developer Console Search functionality and search for any IDs or classnames on your targeted element. You can access this by clicking the command line icon inside Developer Tools.

Screen Shot 2015-04-07 at 4.48.17 PM

You Want To Fire On All Events Of A Particular Type

Sometimes, Triggers will default to asking for a condition when you create them. Typically, you can delete that condition using the – (minus) symbol next to it, then select ‘All Foo’, where foo is the event type.

Screen Shot 2015-04-07 at 4.30.23 PM

What challenges have you faced with the v2 interface?

Dan Wilkerson is a Software Engineer at LunaMetrics. He is passionate about web technology, measurement, and analysis. Dan is the winner of the 1999 Forge Road Elementary School Science Fair for his groundbreaking report on how magnets work. (ICP, take note.) Dan has worked at LunaMetrics in social media, as our marketing manager, and now in our analytics department.

  • http://www.amazeemetrics.com amazeemetrics

    It’s funny that by making GTM “simpler”, Google made things confusing again to all of us who had learned the Rules and Macros of the first version. Thanks for the guide!

    • Dan Wilkerson

      Ain’t that the truth 🙂 thanks for your comment!

      Dan

    • JeremyStreich

      I agree.

  • Kerrie Wuenschel

    Are you having issues with tags populating in the summary section of the debug mode? I am finding that I have to manually click on the summary button in debug mode for them to show up when I did not have to do that in version 1. This makes me worry because I don’t feel as confident that they are automatically firing.

    • Farsana Nasareen

      I too face the same issue.

      • Dan Wilkerson

        Hi All!

        This was a bug in GTM that *should* be resolved.

        Dan

  • Lance N

    Trying to configure a click trigger but the drop down selection trigger type only shows…’all elements or just links’ there is no ‘click’ showing. Maybe i missed something?

    • Dan Wilkerson

      Hi Lance,

      They recently changed the interface so that instead of All Clicks and Link Clicks, it shows All Elements and Just Links. All Elements means the Trigger could apply to any element type, whereas Just Links specifically applies to a-type elements.

      Hope this helps!

      Dan

      • Lance N

        Thanks Dan!! You mean, ‘Just links’ is exactly that an a href tag. I’m trying to simply track PDFS on my site.

  • JeremyStreich

    I’m getting an over count on new tags that should only fire on certian pages when a link is clicked. I didn’t have this problem in version 1. I’m pretty sure it is something I’m doing, but the new interface, while nicer for basic users, makes our complex set up more difficult.

    • Dan Wilkerson

      Hi Jeremy,

      Can you be more specific? I’d be happy to try and help.

      Dan

      • JeremyStreich

        So, we have a single GTM for our whole university (UW-Milwaukee), and everything is tracked in one GA property.
        That creates a horrible sampling issues on smaller sites, so our college (Letters and Science) gives each their own property to run analytics on a local level. For each department we create 5 tags:
        – Page view
        – Email Links
        – External Links
        – PDF Links
        – Word Links

        This worked fine in v1, but since v2 we get an over count of sessions because the events are firing on pages that the first firing rule and exclude rule should prevent — but for some reason don’t.

        Fire On:
        LS – Dept – Translation (Page View)
        url contains translation-interpreting-studies
        LS – PDF (Click [Link Click])
        element url contains .pdf

        exclude
        LS – Dept – Translation – Filter (Page View)
        url contains translation-interpreting-studies

        This works for 30 other sites done before the v2 update, but 4 new sites it doesn’t work. and we get the over count in events and sessions as mentioned above.

        • JeremyStreich

          Here’s the triggers (rules).

          • JeremyStreich

            Here’s the answer: The filter can’t be a page view, it has to be a custom event that matches all events ( i.e. .* ).

          • Dan Wilkerson

            Hi Jeremy,

            That’s correct; in general, this is how you’ll format block triggers that are meant to be conditional, e.g. a page path contains a value.

            Dan

  • Derek Rousseau

    In V1, we could see all tags that use a particular trigger, but I can’t find that functionality in V2. Is there a way to see which tags use a particular trigger?

    • Dan Wilkerson

      Hi Derek,

      The only way I know of is to try and delete the Trigger; a pop-up will show you all the tags it is currently used with.

      Dan

  • Nikunj

    Hi Dan,

    Is there anyway we can fire the tag if there are id name matches on pages. For example

    I want to fire virtual pageview tag on the page let suppose /widget-red.html the virutal pageview (/vpv/red.html) would be fire if the there is element id red present on the page but if that is not there on that page i would like to fire (/vpv/no-red.html) when the element id is “no-red”.

    How can i set a trigger on the page which depends on id name? is there any way i can achieve this.

    It would be great if you can help me.

    • Dan Wilkerson

      Hi Nikunj,

      In that specific example, I would suggest using a Variable within the page path of your tag, and not distinguishing between the two paths with Triggers, e.g.:

      /vpv/{{Red or No-Red}}.html

      In the Variable, I would detect whether that element was on the page and return ‘red’ or ‘no-red’.

      If you need to fire or block certain tags based on items like this, however, you’ll need a Trigger. Use the Fire On option (step 3 or 4) and specify a value (you can even use Regex or “does not match”).

      Dan

  • cagri

    Hi Dan,

    I want to make this trigger work only if theres a purchase on the website. Below are what I put on GTM, but I think I am doing something wrong, cause it counts every visitor as a conversion. Do you have any idea why is that?
    Thanks for the help.
    cagri

    • Dan Wilkerson

      Is that your ‘Thank You’ page? That appears to be a very generic URL.

      Dan

  • Charlene

    Hi Dan,

    Thank you for this very helpful article. I’m running into a problem where I think my Adwords and Facebook Conversion tracking tags are firing double. I think its because they are both using the same triggers ? I also have Standard GA universal events firing the same triggers to count as goals.

    I cant seem to find any advise anywhere on using the same triggers across GA Universal Events for Goals in QA and then on Adwords / Facebook. All tracking the same Contact form 7 form submit form action where there arent any thank you pages.

    Can you perhaps help ?

    • Dan Wilkerson

      Hi Charlene,

      If you’re using a single trigger for both tags, then they should only be firing once. If you have multiple triggers on each tag, that could be the cause. You also might have the GTM snippet on the page twice. Beyond that, you’ll have to start some advanced troubleshooting, which is more support than I can provide in a comment.

      Dan

      • Charlene

        Thank you, I will try splitting out the Tags.

  • juan manuel manzanel

    Hi Dan, i have a simple dude here in GTM. may be you or someone can help me. i am trying to fire one tag in one page, and other in other page after click in the button “Ver datos de contacto”. A pop up is showed when someone click in this button. But after this i have two different pageviews with same variables and same values in that variables. so i cant avoid 2 fired of both tags. how can i fire only both tags only one time? i try obviously with “Tag firing options” but this didnt work. Thanks!

    • juan manuel manzanel

      here is the printscreen

      • Dan Wilkerson

        Hi Juan,

        So, you want to fire two different tags, but the pages share the same URL? Is there anything you can use on the page to detect the difference? For example, could you create a DOM Element Variable that looks for the Ver datos de contacto button, and then use that in a Blocking Trigger? To set this up, you need to select ‘Custom Event’, then enter .* for your event name (check the RegEx box, too), and add that condition to the Trigger. Then apply that Trigger as an Exception to your first tag.

        Screenshot attached!

        Dan

        • juan manuel manzanel

          Thanks for your answer Dan but I couldn´t do that, is exactly the same information in both cases.
          Here you have a print screen of the tags after click in the button “Ver datos de Contacto” .
          If you see, my problem is that i have two different Pageview, DOM Ready and page load. The first one when i go to “http://www.region20.com.ar/vehiculos/peugeot-207-306806.htm” and the others when i click in the button. The Variables are exactly the same.

          Can i avoid the fire on the second pageview? may be exists some restriction to avoid the second fire in the same url, or something like that and i didn´t know

          Thanks again!

          • Dan Wilkerson

            Hi Juan,

            Are you firing GA using Custom HTML Tags?

            Dan

          • Dan Wilkerson

            Hm, regardless, you’re going to need to create some way of differentiating between the two outside of GTM. You could use a Cookie (we have a Cookie Management Tools recipe here – http://www.lunametrics.com/labs/recipes/cookie-management/), or you could ask the developers to decorate the redirected URL with a parameter like ‘?redirect=true’ and then sniff for that. GTM doesn’t have any method that I can think of that would help with this, natively.

          • juan manuel manzanel

            mmm Thanks! but is no my point to avoid two fires, may be decorate de redirected URL is a good solution, but contains development stuff. I trying to dont modify the source code.

          • juan manuel manzanel

            Yes i do!

  • tb727

    I have a question on this. Are the triggers “or” statements or “and” statements in the fire-on if it’s configured this way? I want them to be or but I don’t know if these each have to be set-up separately.

    • juan manuel manzanel

      Hi tb! the or condition can be configured with different triggers, or with regular expressions. ex. you can put Page URL contains RegEx (W|^)(service|special/service|maintenance-schedule……..)(W|$)

      • tb727

        thanks!

        • Dan Wilkerson

          Juan is correct, conditions operate as ANDs, additional triggers are how you do ORs.

  • Suprabhat

    I was stuck in a situation where i needed to capture 2 link click event
    in the same page but i was unable to do so. Should i change the tag firing option to “unlimited” in both the triggers.

    • Dan Wilkerson

      Hi Suprabhat,

      Do you mean you wanted to fire two different Events on the same link click?

      Dan

  • Andrea Lyn Van

    So if I understand correctly – “all elements” does not include items like an href. For an href you need to use “just links.” Up until last week I’ve been using “all elements” for just about everything b/c I thought that would include items like an href as well. That, however, does not appear to be the case. Am I correct?

    For example, if my line of code is:

    Would any of those items be “just links” or just the href and the other items would be “all elements?”

    Thanks!

    • Dan Wilkerson

      Hi Andrea,

      It’s kind of a circle-is-a-rectangle-type problem. Sometimes, All Elements will return the link being clicked on; sometimes it won’t. Link Clicks will always return the link, however. To see this in action, create a trigger with each condition, then in Debug mode click on a link (preferably holding CTRL or CMD to open that link in a new tab). Check out what GTM spits out – an event for each type.

      Dan

  • http://nandangupta.com Nandan Gupta

    Hi Dan,

    I have an issue in GTM but i am not able to find the resolution so i need your help. The issue is when i open my website and click anywhere on page a gtm.click is fire everytime. Do you have any idea or any suggestion how to resolve it? Please share.

    Thanks,
    Nandan

    • Dan Wilkerson

      Hi Nandan,

      This is expected behavior! No need to panic. GTM is just listening for click events the browser already produces and throws.

      Dan

      • http://nandangupta.com Nandan Gupta

        Thanks for your quick reply Dan.

        Any idea how can i stop this tag to fire on every click.

        Please suggest.

        • Dan Wilkerson

          Adjust your Click Trigger to fire only when certain conditions are met, e.g. a particular class is present on the element that is clicked. See my hostname example above to get started!

Contact Us.

LunaMetrics

24 S. 18th Street, Suite 100,
Pittsburgh, PA 15203

Follow Us

1.877.220.LUNA

1.412.381.5500

getinfo@lunametrics.com

Questions?
We'll get back to you
in ONE business day.