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

Excluding route does not work #10

Open
JesseDeBruijne opened this issue Nov 25, 2022 · 3 comments
Open

Excluding route does not work #10

JesseDeBruijne opened this issue Nov 25, 2022 · 3 comments

Comments

@JesseDeBruijne
Copy link

In my app, I have a login process that redirects the user to a page called /auth-callback?... with a bunch of parameters there.
I don't want to log this page to PIWIK because it's not relevant to our analytics and contains some sensitive data (which I can filter out using parameters).

I've tried to exclude this route by doing this:

NgxPiwikProRouterModule.forRoot({ exclude: [ "*auth-callback*" ] }),

and I've tried this with other variations too:

exclude: [ "*/auth-callback*" ]
exclude: [ "/auth-callback*" ]
exclude: [ "auth-callback*" ]
exclude: [ /(auth-callback)/ ]

But the page keeps popping up in the tracker debugger.

Am I doing something wrong in my code? Or is the exclude/include function not working properly?

@danieltwork
Copy link
Contributor

danieltwork commented Nov 25, 2022

@JesseDeBruijne Hey, thanks for reporting the issue. I need to check what the problem is and will get back with an answer.

@JesseDeBruijne
Copy link
Author

Hi @danieltwork

I've now tried to implement my own page view tracking using the PageViewsService and subscribing to the Routing events from Angular (excluding the auth-callback page). I have removed the NgxPiwikProRouterModule.forRoot(...) from the app.module.ts but it looks like it is still performing post requests automatically. As a result, I still see the auth-callback page in my Network tab being posted to Piwik.

this.router.events.pipe(distinctUntilChanged((previous: any, current: any) => {
      // Subscribe to any `NavigationEnd` events where the url has changed
      if (current instanceof NavigationEnd) {
        return previous.url === current.url;
      }
      return true;
    })).subscribe((x: any) => {
      // Don't log auth-callbacks since they contain a login code
      if (x.url.indexOf("auth-callback") >= 0) {
        return;
      }
      this.pageViewsService.trackPageView(x.url);
    });
  }

The way I'm reading the documentation, it should only automatically log page views when the NgxPiwikProRouterModule is imported. This does not appear to be the case.

@KENNyPL
Copy link

KENNyPL commented Nov 12, 2024

I have the same issue on my side im using @piwikpro/[email protected]

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

3 participants