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

Do not track URL after hash #330

Open
ro31337 opened this issue Aug 6, 2024 · 1 comment
Open

Do not track URL after hash #330

ro31337 opened this issue Aug 6, 2024 · 1 comment

Comments

@ro31337
Copy link

ro31337 commented Aug 6, 2024

I have a service where URL looks like:

https://example.com/x/sessionID#sessionKey

I don't want sessionKey to pop up in logs like this:

image

But sessionId is OK. Is there any way to omit sending #sessionKey part? I had to switch off the shynet analytics for all session pages because of that. Looking for options or feature to implement.

@neerdoc
Copy link

neerdoc commented Oct 24, 2024

If this is implemented it should only be as an option in the setup. It's very common to use # to indicate parts of a page, especially for one-page applications. So for many pages the data after # should be saved because it basically indicates pages.

I do think that any data after a question-mark (?) should be removed since that often contains POST data, etc. But that is perhaps already done?

Hint: It entirely possibly to edit the script that sends the data. I have downloaded the script from my setup and then included it in the site which I want to track as a local included js. If that is a possible solution for you @ro31337 you can easily fix this for your site by editing the script.js. Basically this part:

       xhr.send(
        JSON.stringify({
          idempotency: Shynet.idempotency,
          referrer: document.referrer,
          location: window.location.href,
          loadTime:
            window.performance.timing.domContentLoadedEventEnd -
            window.performance.timing.navigationStart,
        })
      );

Change into this:

       xhr.send(
        JSON.stringify({
          idempotency: Shynet.idempotency,
          referrer: document.referrer,
          location: window.location.href.split('#')[0],
          loadTime:
            window.performance.timing.domContentLoadedEventEnd -
            window.performance.timing.navigationStart,
        })
      );

Disclaimer: I have not tested this, but it should work.

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