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

Original visit url is missing - do not remove campaign query parameters from url reports #14324

Closed
rtyshyk opened this issue Apr 8, 2019 · 5 comments
Labels
answered For when a question was asked and we referred to forum or answered it. Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.

Comments

@rtyshyk
Copy link

rtyshyk commented Apr 8, 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

https://example.com/slug?utm_campaign=campaign&utm_term=term&foo=bar&pk_campaign=zoo

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.

Thanks!

@tsteur
Copy link
Member

tsteur commented Apr 9, 2019

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
Copy link
Author

rtyshyk commented Apr 9, 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
Copy link
Member

tsteur commented Apr 10, 2019

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();
    }
}

@tsteur tsteur added the Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. label Apr 10, 2019
@tsteur tsteur changed the title Original visit url is missing Original visit url is missing - do not remove campaign query parameters from url reports Apr 10, 2019
@tsteur tsteur added this to the Backlog (Help wanted) milestone Apr 10, 2019
@bcumberledge
Copy link

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.

@mattab
Copy link
Member

mattab commented May 17, 2023

Thanks for contributing to this issue. we recommend to use the MarketingCampaignsReporting plugin and if you have any problems with it, please create an issue here: https://github.com/matomo-org/plugin-MarketingCampaignsReporting/issues

Otherwise you maybe able to keep all campaign params by editing campaign_var_name and campaign_keyword_var_name in the Matomo config.ini.php file.

@mattab mattab closed this as not planned Won't fix, can't repro, duplicate, stale May 17, 2023
@mattab mattab added wontfix If you can reproduce this issue, please reopen the issue or create a new one describing it. answered For when a question was asked and we referred to forum or answered it. and removed wontfix If you can reproduce this issue, please reopen the issue or create a new one describing it. labels May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered For when a question was asked and we referred to forum or answered it. Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
Projects
None yet
Development

No branches or pull requests

4 participants