Hi! In the documentation I can read the following:
"By default Piwik will create a new visit whenever a visitor views your website using a different campaign information from the visitor’s ongoing visit. You can disable this behavior by setting create_new_visit_when_campaign_changes=0 under [Tracker] section in your config/config.ini.php file."
But it is not working for me. When I visit my website using different campaigns, Piwik registers always the same campaign established in the cookie a long time ago. It only changes when the session ends and I visit the website using a different campaign (but it has to be the first visit after the session ends, because if not, the old campaign is set again for the new visit).
Btw, is it the intented behavior to keep the same campaign even when the session ends and after that the user visits the site without any campaign specified in the url?
Thank you very much in advanced.
Do you have the Marketing Campaigns Reporting plugin installed?
No, I don't have the Marketing Campaigns Reporting plugin installed.
This cookie _pk_ref.xxxxx contains information about the campaign and keyword; if I delete it, everything behaves the way it should (creating a new visit for every new campaign, no matter if one is inside the same session). Is this cookie really necessary?
For now, we have chosen not to set this cookie (_pk_ref.xxxxx), this way everything behaves as we want to. The problem is when this cookie is set, and this happens when the first visit to the site (I mean, without an active session) ocurres with a campaign (URL?pk_campaign=c1, for example); after this, no matter what you do, all new visits (with or without campaigns) are going to be associated with the campaign set in the previous example. All of this happens because of _pk_ref.xxxxx cookie.
Came here because of the forum issue https://forum.matomo.org/t/campaign-is-there-a-tracking-timeout-after-user-clicks-one-link/28690/7 - this is reproducible in my instance as well.
This is because of https://github.com/matomo-org/matomo/blob/c0d6e951f12a8b0585ffd81d68d48309778afbd4/js/piwik.js#L4267 - if a campaign referrer was obtained from the cookie, the check for (changed) parameters from the url is not run at all. So the cookie campaign information has precedence over the actual campaign info in the url and the parameter "create_new_visit_when_campaign_changes" cannot have any effect (only with cookies disabled or deleted).