[Bug] Piwik splits visits from campaigns with changing referrers due to for example PayPal Express purchases since update

We recently updated a clients Piwik from some 2.1x version to 2.15 and meanwhile 2.16. Piwik is running a Magento shop with the latest MagePiwik from Adrian Speyer. And since the update to 2.15 more then 50% of all conversions which are fulfilled over PayPal Express are tracked as three visits which look similar to this scheme:

Initial visit: Customer browses the store and eventually is on a products detail page.
Second visit (only seconds later, same IP and ID): Customer creates a cart with his (correctly set) product and revenue while visiting /paypal/express/review/ (this typically means he went from the products detail page directly to PayPal Express, filled everything necessary and came back now ready do purchase.)
Third visit (again only seconds later, still same IP and ID): Customer visits /checkout/onepage/success/ while triggering a conversion, however this conversion has no products or revenu attached and the cart from the second visit stays as abandoned cart in the second visit.

So conversions get tracked but without any revenue which is very bad. Before the update and in a little bit under 50% of cases even now these actions of a customer using PayPal Express are tracked in just one visit where the cart is correctly marked as fulfilled conversion with its revenue.

My biggest problem right now is I wasn’t able to reproduce it myself. So when I try to follow the exact steps of a problematic visitor my own visits gets correctly tracked as one… And so far I’m not even sure were I should start looking. Is this probably a problem of MagePiwik where it’s not setting its ecommerce _paq.push values correctly or is it more likely a problem on piwiks side itself?

// Update:
Okay last update turned out to be only valid in one very specific case. Now it looks like it has something to do with pk_campaign and it only affects those visitors coming from a link with a pg_campaingn parameter set. The following is displayed for each of the three visits as campaign:
Visit 1: paid-test
Visit 2: paid-test - www.paypal.com
Visit 3: paid-test - www.clients-domain.com
So maybe piwik splits the visit as it thinks this are different campaigns due to the changing referrer? …

// Update 2:
The referrer seems to be the culprit. I guess piwik changed something in its referrer handling logic during the last updates. When we manually set a fix referrer via _paq.push(['setReferrerUrl', "client-domain.com"]); it seems all visits are tracked correctly again while the campaign information form pg_campaign is not lost. This is better than converions with no revenue but we now need a clever way to only override the referrer in case of PayPal express purchases so that we still have the real referrer information in our other visits logged as it may be valuable, too. Even better would be some kind of piwik fix :wink:

Any ideas or other input is still welcome.

Have you read this one?

I’m not sure what you try to refer to. Have you read my post or just posted a link judging from some keywords?

As written: We haven’t changed anything but made a minor update which changed the tracking behaviour in the described way. And that effectively made the ecommerce data useless.

But as I usually try to get what people want to say me and actually go through the effort reading stuff I quote from your own link:

By default, Piwik won’t create a new visit when a visitor views your website using a different website referrer information.

But exactly that is what Piwik is doing since the update and in case a visit came from a campaign: It is creating new visits when the referrer information changes (also we obviously have not explicitly set the config parameter for this while we did our update…). I guess Piwik is confusing campaign information with referrer information in this case or something similar. But that’s more for you to find out. And in case you don’t feel like it as this is not about the PRO version it still would be better you wouldn’t post at all. This way 20 minutes of my time would have been saved.

This behavior changed in Piwik 2.10 so it works as designed. With the default configuration, Piwik is forcing a new visit whenever the campaign referrer changes. And it’s important to note, that Piwik uses the same column in the database to store referrer and campaign information. So, if the campaign parameter (e.g. campaign name) is set, Piwik won’t save the HTTP referrer, e.g. some other website.

My recommendation is to add these lines to your config.ini.php file:
[Tracker]
create_new_visit_when_campaign_changes = 0

This will set Piwik to work exactly as before the update.

See also this one:

Okay.

But this isn’t a really good architecture or is it…? I’d say both information (campaign and referrer) have value on it’s own and therefore it would be a good thing if we could use/see/wse them separately. But well…

@Falma I agree. Hopefully, we will have this improved in the future versions. :slight_smile: Maybe in the referrers report it makes sense to display only one referrer in such case (either a website or a campaign), but displaying both in the visitor log may be valuable as well (e.g. when somebody used the same campaign name on different websites, etc.). Cheers!

Hi Falma, if you want to be helpful, please consider creating a bug report (or “documentation bug report”) if some of our FAQs (or code) is not working as expected. We’ll do our best to improve it.