react-gtm
react-gtm copied to clipboard
How to turn off after initialized?
I have this flow in my app:
- When my web app loads I run:
TagManager.initialize({ myConfig });
- But if my user clicks on Decline Cookies I need to turn it off
Is there any function like: TagManager.turnOff
that will remove all cookies associated with Google Tag Manager?
Same here any solution.
@LucasAndrad I think ONLY if the user consents with your cookies usage, you should initialize TagManager?
No @dcorb, that's not the flow the company wants. That first track of TagManager is anonymous, so no need any consent for that (at least following the company country laws)
How about add a persistent condition-trigger like:
if (userAcceptCookies) {TagManager.initialize({ myConfig })}
Anyone found a solution?
I'm no expert but
That first track of TagManager is anonymous,
So that's fine
Then later, push the userId and other private data into the dataLayer only if they consented. If anonymous data is good prior to consent it should be good after.
Otherwise, convince the company to start it post consent for consistency?
Having the same issue.
The user could accept all cookies and later on update his preferences to deny tracking for example. That could be a use case to turn off the tag manager. A TagManager.turnOff()
method would be handy.
Another option would be to use the API for consent settings via Google Tag manager. https://developers.google.com/tag-manager/templates/consent-apis
However, I didn't manage to make it work with this library.