A number of pages on the site have a custom field that contains a word or a phrase (industry market segment) that get displayed in my dataLayer. I am then using that market segment variable to trigger a dynamic/custom fly-in box on those pages using Google Tag Manager.

I am having trouble getting these triggered using only one trigger filter. I have tried setting the filter to this using regex or statement:

Fire On Some Pages -> {{DataLayer Variable}} -> Match RegEx -> Market Segment 1|Market Segment 2

Edit - Here are the screenshots of the tag, trigger and variable:

Tag - Text in the Fly Box is populated via variables using the look up table GTM Custom HTML Tag

Trigger GTM Trigger

Variable that catches the Market Segment from the site GTM dataLayer Variable

One Example of a varible that uses the one above to populate the text dynamicly based on market segment. GTM Variable Lookup Table

The tag is not firing. Am I using the wrong regex or is there another way to do it. I have about 12 market segments and really don't want to create separate triggers for each one. Kind of defeats the point of using GTM.

  • Can you post a screenshot of your trigger, tag, and DataLayer Variable definition? – nyuen Nov 29 '16 at 16:49
  • @nyuen I edited the question. The problem seems to be with the trigger because if I just match it to one it seems to work for that market segment but when I try to match multiple then things get messed up. – dasickle Nov 29 '16 at 18:29
  • When does the datalayer get populated? Before or after the pageview tag? – sdhaus Dec 14 '16 at 3:22
  • that depends on where you push the data into the dataLayer. If you do it before the GTM container code (as is recommended for initializing the dataLayer with certain values) the value would be available. If you get this data later and push it into the dataLayer (i.e. dataLayer.push({});) you might want to consider adding a 'event':'box_event' and then using that event as a trigger for your HTML tag since it'd ensure that the variables are populated in the dataLayer – Killerpixler Dec 20 '16 at 16:59
  • I agree with Killerpixler. If GTM_WP_Market doesn't get resolved upon gtm.pageview, it will not be in the dataLayer. If your tag works with a custom event as a trigger you might want to look into your dataLayer setup. See if GTM_WP_Market can be found within the dataLayer either by looking at the source (should look similar to this: dataLayer = [{'GTM_WP_Market': 'Automotive'}] or use GTM Preview, select Pageview from the left and click on the Data Layer tab. – SomewhereDave Mar 28 '17 at 8:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.