Google Tag Manager – Track only with Opt-In

Jones-S
13
Jones-S
commented 6 months ago

I want to only track page views when the user opts-in.
I have an opt-in button that sets a localStorage cookie cookie:accepted to true.

Now I want to use my trigger nuxtRoute only to be triggered if that cookie is set to true.

So my trigger has this rule:
Screenshot 2019-10-09 at 14 55 29

Where the referenced variable looks like this:
Screenshot 2019-10-09 at 14 58 43

But still my nuxtRoute trigger appears in the debug bar all the time.
Screenshot 2019-10-09 at 15 00 36

Is this because I use localStorage instead of a cookie?
Or is this the wrong approach to handle this?

I would be really glad if somebody could elaborate a bit how this module is actually used…

Thank you in advance.

0
Jones-S
13
Jones-S
commented 6 months ago

Indeed it was because I had to use actual cookies.
Then it should work.
Also it was necessary to push an event manually which the module normally does on each routechange. (I just trigger it as soon as the user opts-in)

0
Informations
QuestionResolved
#c170 - Created 6 months ago