Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

custom event trigger in google tag manager

Every time i create a custom trigger event it doesn't get fire. Can anybody please what may be the reason. I have created 'gacustomevent'custom triggerand have name it 'gaevent' but the event is not getting fired. Iwant to use the event in the dataLayer to capture the value. Any advice on how to get issue resolve

like image 645
owais Avatar asked Dec 09 '22 02:12

owais


1 Answers

It's a bit unclear from your question how you set this up. It should look like this:

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

(this assumes that the dataLayer is already initialized).

In GTM you go to the "variables" section. In the boxes with the predefined variables you hit the checkbox in front of "event". Now you're ready to use your custom event in a trigger.

Go to "trigger", select new -> custom event. In the event name box you enter "myEvent" (as per my example, substitute with your own value).

The custom event only works when there is a key/value pair in the dataLayer where the key is "event" (that's kind of a 'reserved word' in GTM). The event name is always the value for that key.

like image 83
Eike Pierstorff Avatar answered Jan 14 '23 13:01

Eike Pierstorff