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
Campaign name with capitals will create duplicate visits #12250
Comments
Thanks for the report @laszlovl sounds definitely like there is a bug. I suggest to discuss the default value in #9944 . Feedback is important and very appreciated on this topic. I can't also say much about the logic being fragile and whether keyword should be considered or not. I recommend creating a new issue for this where we can focus the discussion on this. |
I tried reproducing this issue but in my case it didn't create a new visit. The internal action/page url was added to the visit with |
@mattab Just checking - are you sure that you're testing with create_new_visit_when_campaign_changes enabled (e.g. the default value)? Also, not sure if it makes a difference, but my setup has the markting campaigns plugin enabled. |
@laszlovl just tried to reproduce with the MarketingCampaignsReporting plugin enabled, and could not reproduce |
I just tried, and I could still reproduce the issue on a Piwik 3.2.0 install. Let me clarify the steps to reproduce:
Now your visit log will show two separate visits. Note that the issue will only occur when
|
I haven't yet tried these exact steps, could in the meantime could you try replace the file piwik/plugins/Referrers/Columns/Base.php and check if this helps? If it does, then likely the bug would be in the plugin itself and will need to investigate further |
That doesn't fix the problem. To te clear, I debugged the problem down to the exact line of code as described in my original post. A crude patch like this one fixes the issue at hand, I'm just not sure if fixing it like that it would be ignoring a deeper underlying issue. --- a/plugins/Referrers/Columns/Base.php +++ b/plugins/Referrers/Columns/Base.php @@ -366,7 +366,7 @@ abstract class Base extends VisitDimension $this->detectCampaignKeywordFromReferrerUrl(); - $isCurrentVisitACampaignWithSameName = $visitor->getVisitorColumn('referer_name') == $this->nameReferrerAnalyzed; + $isCurrentVisitACampaignWithSameName = strtolower($visitor->getVisitorColumn('referer_name')) == strtolower($this->nameReferrerAnalyzed); |
Fyi: we've created & merged a PR here: #13469 |
Great! That's pretty much what I've been running in production for a year (though |
?pk_campaign=Campaignname
The second action will create a new visit. Because of that, goals in that visit won't be properly attributed.
The issue is in https://github.com/piwik/piwik/blob/master/plugins/Referrers/Columns/Base.php#L369:
$visitor->getVisitorColumn('referer_name')
contains the lowercased value ("campaignname"), while$this->nameReferrerAnalyzed
contains the original value ("Campaignname"). Because of this, the fix for #9299 won't be applied andCampaign::shouldForceNewVisit
will force a new visit.In general, this logic feels quite fragile. Is it really right to consider a changed
referer_keyword
value as a sign that the campaign changed, whenreferer_keyword
is sometimes set by internal logic instead of directly from tracking attributes? IfshouldForceNewVisit
would only look at the name & type, the workaround code could be removed.FWIW, I agree with #9944 that create_new_visit_when_campaign_changes is counter-intuitive and should be disabled by default.
The text was updated successfully, but these errors were encountered: