react-gtm icon indicating copy to clipboard operation
react-gtm copied to clipboard

How to turn off after initialized?

Open LucasAndrad opened this issue 4 years ago • 7 comments

I have this flow in my app:

  1. When my web app loads I run: TagManager.initialize({ myConfig });
  2. 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?

LucasAndrad avatar May 20 '20 14:05 LucasAndrad

Same here any solution.

bsteps avatar May 25 '20 06:05 bsteps

@LucasAndrad I think ONLY if the user consents with your cookies usage, you should initialize TagManager?

dcorb avatar Jun 01 '20 04:06 dcorb

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)

LucasAndrad avatar Jun 01 '20 13:06 LucasAndrad

How about add a persistent condition-trigger like: if (userAcceptCookies) {TagManager.initialize({ myConfig })}

maxrojasdev avatar Jun 23 '20 06:06 maxrojasdev

Anyone found a solution?

zuzuleinen avatar Aug 12 '20 12:08 zuzuleinen

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?

framerate avatar Sep 12 '20 00:09 framerate

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.

cdelacombaz avatar Nov 02 '21 08:11 cdelacombaz