Closed jkohlin closed 2 years ago
@jkohlin I am looking for the same thing, were you able to find a solution for consent management?
Yes, sorry. Forgot about this question.
This works:
TagManager.dataLayer({dataLayer: ['consent', 'update', { ad_storage: 'granted' }]})
@jkohlin does it though? when I use tag assistant to inspect, I don't see consent events being fired by just passing an array. An array is not equivalent to an arguments object passed into the data layer by the gtm examples. I needed to implement a helper to make this work for me.
gtag.ts
import TagManager from "react-gtm-module";
export function gtag(...args: any[]) {
TagManager.dataLayer({ dataLayer: arguments });
}
@dopry I don't remember how we set this up in tag manager and I don't have access to it anymore but this worked in our case anyway.
Just passing by to understand if someone still recommends this solution?
If I want to perform the following
gtag('consent', 'update', {'ad_storage': 'granted'}
GTM preview will list Consent like this:What is the equivalent using
TagManager.dataLayer()
? Or perhaps I should use another method?