Auto-Event Variable(like in GTM)

Hi,

Is there any way how I can set up an Auto-event Variable like in GTM that works the same way?

Thanks in advance!

Hi,

There is no possibility to set Auto-event Variable that way. In some cases workaround is possible, but it depends on particular use case.

We can try to find a solution if you describe your use case.

Maciej

Hi @Maciej_Kowcun ,

We have an Auto-Event Variable in GTM that we want to migrate into Piwiks Tag Manager. Basically, the Auto-Event Variable is grabbing one of our Element Attributes called “data-gtm”.

Auto-Event Variable GTM

The returned value in the Auto-Event Variable is then used and modified in two Custom Javascript Variables. These two Custom Javascript Variables are then used in Triggers and Tags.

If you have any workaround for this, I would be really thankful!

Hi,

Unfortunately there is now workaround right now. We are working on variables inside variables, which should make it possible. It will be ready in the next couple of weeks.

1 Like

Hi @Dataguy,

As a workaround you can create a Custom JS variable which returns the value of the data-gtm attribute.

function() {
return dataLayer.slice().reverse().find(x => x.event === "stg.click")?.element?.dataset?.gtm;
}

Please note that optional chaining (?.) used in the example above might not work on older browsers so if you have users that use these browsers I would recommend to compile that code with Babeljs.

Hi @kamilb ,

Thanks for reply! I will try it out :slight_smile: