Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to init matomo _after_ user has accepted terms? #91

Open
tarlepp opened this issue Nov 12, 2022 · 5 comments
Open

How to init matomo _after_ user has accepted terms? #91

tarlepp opened this issue Nov 12, 2022 · 5 comments
Assignees

Comments

@tarlepp
Copy link

tarlepp commented Nov 12, 2022

We've an issue because we don't want to initialize Matomo, before user has accepted the terms of service. How would we do this?

For now it looks like that init is causing that matomo is loaded before user has accepted this.

@Arnaud73 Arnaud73 self-assigned this Dec 28, 2022
@Arnaud73
Copy link
Owner

I would start by adding requireConsent: true to the MatomoConfig and then, once your user has accepted the terms of services, I would call this.matomoTracker.setConsentGiven() which will everything to your Matomo instance.

@tarlepp
Copy link
Author

tarlepp commented Jun 27, 2023

Actually that didn't do the trick for me - I needed to track that state myself to get all working as expected.

@Arnaud73
Copy link
Owner

If you'd like to check the "standard" behavior, then:

  1. Clone this repo
  2. Build ngx-matomo : npm run build:ngx-matomo:prod
  3. Run the demo app : npm run test

You'll see that in this app, no tracking occurs before user consent is provided.

If your use case required something different, I'm willing to have a look at it!

@Arnaud73 Arnaud73 reopened this Jun 27, 2023
@tarlepp
Copy link
Author

tarlepp commented Jun 27, 2023

Yeah, the main reason is that we need to use this plugin - https://plugins.matomo.org/AjaxOptOut - and if we do that your.piwik/index.php?module=API&method=AjaxOptOut.isTracked request tracking is started.

So I just resolved this by storing this tracking status to local storage and if it's accepted then I do that query otherwise not - simple solution after some testing.

@Arnaud73
Copy link
Owner

Thanks for the information.
Once I nicely integrate MediaTracking and Form Tracking, I'll check how to provide a better way to interact with plugins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants