question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Opt-out for multiple domain tracking not working

See original GitHub issue

Description

Hello, I’m trying to combine the use of multiple domain tracking, bootstrap and opt out but it doesn’t seems to be working.

Expected behavior

I would like for my user to be able to opt-in and opt-out simply by clicking on a button to activate it or not.

Actual behavior

When I’m calling this.$gtag.optOut(), it stops triggering the main id (UA-XXXXXXXX-1) but the id specified in includes (UA-XXXXXXXX-2) is still used to trigger events to Google Analytics.

Here is my code in main.ts:

Vue.use(VueGtag, {
  config: { id: "UA-XXXXXXXX-1" },
  includes: [
    { id: "UA-XXXXXXXX-2" }
  ],
  bootstrap: false,
  enabled: false
}, router);

And when I’m using it:

bootstrap().then(() => {
  analyticalCookie.IsAccepted ? this.$gtag.optIn() : this.$gtag.optOut();
});

Maybe I misinterpreted something in the documentation and it works as supposed to.

Thanks in advance, I can give more details if needed 😃

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
lisafrancoisecommented, Feb 10, 2020

That’s already what I’m doing but the permission can change during the user navigation.

My issue is this one:

  • A user logs to our website. We make an api call to know if they accepted analytical cookies. When we get the response, we bootstrap. That user goes to the Settings page and decide that they don’t want to accept analytical cookies anymore. So they click on a button and when they click, we are calling this.$gtag.optOut() to stop sending events to Google Analytics. It works for our main id (UA-XXXXXXXX-1 in the first post) but not for the one added in the includes section (UA-XXXXXXXX-2). For this one, views events are still send to Google Analytics.
0reactions
MatteoGabrielecommented, Feb 17, 2020

🎉 This issue has been resolved in version 1.6.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Detect & Fix a Google Analytics Cross-Domain ...
Use this guide to diagnose and fix Google Analytics cross domain tracking issues before they ruin your data.
Read more >
Implementing the Opt-Out Cookie - Tracking Visitor Sessions
Because cookies are domain-specific, if you have multiple domains, you need to set the opt-out cookie for each domain. If you have multiple...
Read more >
How to set the google analytics opt-out cookie for sub- ...
I would like the opt-out of the cookie to be valid on all the subdomains. How to I accomplish this ? The code...
Read more >
How to create an Opt-Out link for Google Analytics
Did you know that you must offer a link to opt out from Analytics tracking on your site? Here you are going to...
Read more >
Tracking Multiple Websites with the ClickDimensions ...
You do not need to create a new domain record for each subdomain--it will work off your main domain record. You will also...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found