Custom Event Trigger in Google Tag Manager

Every time I create a custom trigger event it doesn't light up. Someone can please what may be the reason. I created a "gacustomevent" regular trigger and named it "gaevent", but this event is not fired. I want to use an event in the dataLayer to capture the value. Any advice on how to fix the problem.

+3


source to share


1 answer


From your question, it's a little unclear how you set this up. It should look like this:

dataLayer.push({
   'event':'myEvent'
})

      

(this assumes the data file has already been initialized).



In GTM, you go to the "variables" section. In fields with predefined variables, you check the box before the "event". You are now ready to use your custom event in your trigger.

Go to "trigger", select new → custom event. In the event name field, you enter "myEvent" (as in my example, replace your own value).

The custom event only works when there is a key / value pair in the data file, where the key is an "event" (this is a "reserved word" in GTM). The event name is always the value for this key.

+12


source







All Articles