@rtyshyk opened this Issue on April 8th 2019

Hi there,

It is really strange that matomo removes some query parameters from URL and this data is lost forever.

I am talking about utm_* marks and other marketing keys. There are missing either over UI or API.

For example, user open a website with the next URL


The API returns

   "url": "https://example.com/?foo=bar",
   "subtitle": "https://example.com/?foo=bar"

I suppose it is OK for the subtitle, whatever it means, but the URL MUST contain the original URL.

Is it by design or some bug?

Expected result:

It must be possible to get the original URL with all query parameters.


@tsteur commented on April 9th 2019 Member

It is currently by design. Are you familiar with PHP? It would be a few lines of code to not replace any URL parameters or to change which ones will be removed and which ones not by listening to the Tracker.PageUrl.getQueryParametersToExclude event hook.

@rtyshyk commented on April 9th 2019

@tsteur Thanks! Does it mean that I have to provide a pull request? Or I have to make custom module and fix it there?

@tsteur commented on April 10th 2019 Member

You would need to make a custom plugin for this as we likely won'T work on this for a while. https://developer.matomo.org/guides/getting-started-part-1 shows how to create a plugin, there it explains you how to listen to an event: https://developer.matomo.org/guides/events

All you need is something like this:

class MyPlugin extends \Piwik\Plugin
    public function registerEvents()
        return array(
            'Tracker.PageUrl.getQueryParametersToExclude' => 'doNotExcludeParameters'

    public function doNotExcludeParameters(&$parametersToExclude)
        $parametersToExclude = array();
@bcumberledge commented on November 21st 2019

Yes, requesting this too. I actually never noticed this until I added the use of utm_kwd Or maybe the campaign plugin did this or a recent update. I'm not sure which of the 3 is the root cause or I am mistaken. I now think it should not keep campaign urls (or be an option). The issue now is it is only keeping pk_kwd in the url fragments. (OH only 2 is supported) Campaign plugin makes a mess of things and can't use it for more.

Powered by GitHub Issue Mirror