Tracking only certain URL parameters

We are hosting Matomo (v4.14.2) for analytics data and are using the default JavaScript tracking code as given by our Matomo install.

Our website uses a bunch of parameters in the URL and we’ve added many of those to the Global list of Query URL parameters to exluce in the global settings, but since we usually only care about the first parameter and a couple of specific ones, I was wondering if there was a way to do this more dynamically.

So what I would like to do is:

  • always track the first parameter in the URL unless it’s one of the globally excluded ones
  • always track the parameters we are interested in
  • drop everything else

Any advice how to do this?

Hi @mikar
As you use JavaScript tracking, you could reset the tracked page URL via setCustomUrl( string ):

The URL you must provide must let the protocol, host and pathname and filter the search (query params):

1 Like

Thanks @heurteph-ei! I’ll look into using setCustomUrl() to track the desired URLs.