@feelydh opened this Issue on May 9th 2017


If the value of the pk_campaign parameter is different, we want the new visit to be counted.

The piwik guide says that the basic settings are so.
(Create_new_visit_when_campaign_changes = 1)

But the test results were different.

The default session time is 30 minutes and will only be applied after the end of the session, right?

I eventually changed the piwik.js source code myself

Looking at the code, we do not store the values ​​of the pk_campaign and pk_key parameters in the cookie when there is a session cookie (ses)

Regardless of the session cookie, we changed the cookie back to save if the value of the pk_campaign parameter differs from the value stored in the cookie

" if (!cookieSessionValue){ " ==>" if (!cookieSessionValue || {The corresponding conditional statement}){ "

After modifying, it was tested again,
Regardless of the default session time of 30 minutes Create a new visit every time a user visits website with a new campaign.

(Create_new_visit_when_campaign_changes = 1) Is the purpose of this setting the same?
Or is there a way to get the same result without doing it like me?

@sgiehl commented on May 29th 2017 Member

When setting Create_new_visit_when_campaign_changes to 1, a new visit should be enforced if the same visitor comes back with a different campaign (within the session). No information about the campaign is saved in any cookie. The recognition is done by the visitorId saved in the cookie. Using this ID Piwik checks if the user has a new campaign than before.

Are you using any additional plugins for campaign tracking?

@peterbo commented on June 8th 2018 Contributor

Duplicate of #12218

This Issue was closed on June 21st 2017
Powered by GitHub Issue Mirror