?...), and fragment (#...)—to Usertour’s servers.
If your URLs contain sensitive information like session tokens, user IDs, or secret keys, you can filter them out before they leave the browser. This method lets you sanitize URLs while still keeping the tracking and conditional logic working properly.
When to use
- Your URLs contain sensitive data (tokens, secrets, PII) that shouldn’t be sent to external servers
- You want to normalize URLs by removing tracking parameters or temporary identifiers
- You need to comply with privacy requirements that restrict what URL data can be transmitted
- You want cleaner analytics by stripping unnecessary query parameters
Parameters
A function that receives the current URL string and returns a
filtered/sanitized version. The function should return a string representing
the cleaned URL. Pass
null to reset to Usertour’s default behavior (sending
the full URL unmodified).Examples
Remove all query parameters
The simplest approach—strip everything after the? to remove all query parameters:
Remove specific sensitive parameters
Maybe you need some query parameters but want to strip out specific ones like tokens or session IDs:view while removing sensitive authentication data.
Remove only a specific parameter
If you just need to filter out one problematic parameter:Hash sensitive parameters instead of removing them
Sometimes you want to keep the structure but anonymize the values:Reset to default behavior
To go back to sending the full URL:Verifying your filter works
After setting up your URL filter, here’s how to verify it’s working:- Visit a page in your app with a filtered URL (e.g., one with sensitive query parameters)
- Go to Usertour’s dashboard → Users section
- Find your own user and click to view details
- In the Activity feed, find a recent event (like Flow Started)
- Expand the event and check the Page URL attribute—it should show your filtered URL, not the original
Notes
- Call this method early in your initialization, right after
usertour.init()and before any flows appear - Your filter function runs every time Usertour needs to report the current URL
- The filtered URL is used both for flow conditions and analytics tracking
- Make sure your filter doesn’t break URL-based flow conditions you’ve already set up
- The function should always return a valid URL string
- Consider performance—this function may be called frequently, so keep it lightweight
- The original URL in the browser address bar remains unchanged; only the URL sent to Usertour is filtered