-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Fix to allow campaign switching during a session #20336
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
Conversation
The fix actually looks fine to me. The test failures are related to that change, as some of the fixtures try to track visits providing the attribution data (_rcn) directly. Those visits are no longer attributed to those campaigns. We nevertheless need to discuss this solution with @mattab and/or @tsteur in detail, as no longer using the attribution parameters to attribute visits is actually a breaking change. Even though it should also fix a couple of other issues we had around differing detection with core and MarketingCampaignsReporting plugin. |
@mattab can you have a look at this one? @bx80 are you aware of any specific reports that would no longer work or anything that will break or any behaviour that changes that people may have expected to work previously? Do I see it right that now only otherwise |
@tsteur Yes, |
@bx80 That is not fully correct. The attribution parameters like @tsteur @mattab What we actually need is a clear definition how the attribution should work. We over and over again are trying to fix certain issues in the attribution. Without knowing exactly how the whole thing should work we will most likely create new regressions each time we try to fix something... |
Thanks for the extra detail @sgiehl 👍 Totally agree that a definitive specification for attribution is sorely needed. It's difficult to fix issues without knowing exactly what the correct behavior should be and thus often ends up as fixing symptoms and not causes. I think it would be a valuable piece of documentation both for developers going forward and for advanced users wanting a deeper insight into attribution data. 🚀 |
Personally I think this should be good to merge, once all tests have been fixed. |
The two tests that are breaking are both when, in a single visit, a second link is followed with the same It's currently: This PR: vs Existing behaviour: @sgiehl Perhaps rather than completely ignoring the |
@bx80 That's something we could implement. But that makes all that stuff even more complex. |
From @mattab via slack:
I've updated the two failing referrer tests to reflect the new behaviour. @sgiehl Would it be possible to share the source of the attribution / referrer diagram you created? It'd be good to update it with this behaviour change. |
@bx80 I had posted the charts here: #18612 (comment)
That actually doesn't reflect what this PR will changes. We will simply ignore campaigns sent with the attribution parameters in the future. So actually a second "visit" does not have a campaign set at all. |
@sgiehl Yes, this was in relation to the two tests that specifically check that a new visit is not created when the referrer host is different but the campaign is the same. This PR changes that behaviour, hence the need to confirm that it's okay to create a new visit if the referrer is different but the campaign is the same.
Not from the referrer attribution parameter which we now ignore, but the second visit can have a campaign via one of the campaign URL parameters, eg. I can recreate your attribution diagram in a shared tool, update it to reflect what this PR will change and then maybe that should be reviewed and should become the definitive document on how things should work? There are still some tests failing (not having a campaign when one was expected), I'll chase those down. |
@bx80 The problem is still, that we now always ignore those parameters for visit attribution. And at least according to the tracking documentation those parameters should work. See https://developer.matomo.org/api-reference/tracking-api Looking at the attribution flow we would basically remove this parts: This needs to be confirmed by @mattab |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From a code point of view the changes are looking fine.
As mentioned in the previous comment we might need to update the documentation once this has been changed.
As it would be a breaking change, which we should avoid for a minor release, we could implement that using a config flag for now. like use_attribution_cookie_for_visit_attribution = 0
as default, to give people the possibility to use this in Matomo 4 already and fully change that in Matomo 5 as a breaking change
The change makes sense to me overall if i understand the discussion correctly. 👌 But additionally because it's a tricky topic that we ideally want documented, to really confirm @bx80 Would it be maybe possible to see the diagram after the change? (we have tools like Miro or Figma we can use btw) |
I don't think it's needed to hide behind a flag in this case 👍
Which documentation do you think should be updated @sgiehl? |
This would be the new flow for visits if the attribution parameters are ignore for visit attribution. The documentation that would need to be updated is https://developer.matomo.org/api-reference/tracking-api |
This issue is in "needs review" but there has been no activity for 7 days. ping @matomo-org/core-reviewers |
@sgiehl If we're not going to add a config flag, then other than updating the developer docs, are you now happy for this to be merged? |
56b1386
to
5d687a2
Compare
@bx80 As mentioned before: from a code side of view those changes would be ready to merge. Even though it could make sense to mention in the change log that the attribution parameters can no longer be used to attribute visits. BUT this is some sort of breaking change. So we should not include that in a patch release. We should either implement it using a config flag or at least release 4.14.0 instead of 4.13.4 |
5d687a2
to
bc6dd58
Compare
…l Attribution" - improved doc as it wasn't quite clear - moved cvar doc to the bottom of the other section follows up matomo-org/matomo#20336 #705
Description:
If a visit is started using a link for campaign A and then a link for campaign B is used in the same session, a new visit will correctly be created for campaign B but all subsequent actions will still be associated with the campaign A visit.
This is happening because the JavaScript tracker only stores the first campaign in the attribution cookie and does not update it if the campaign changes within the session. Recent improvements for conversion attribution (PR #19200) mean that the first campaign name is now passed to every tracking request for the session using the
_rcn
parameter, this then causes all actions to be matched to first visit.Rather than remove the changes in the JavaScript tracker providing the first campaign name, which are needed for other functionality, this PR changes the server side campaign detection to no longer detect the referrer campaign from the
_rcn
or_rck
request parameters instead the campaign will only be detected from the campaign_var_name values (default: pk_cpn, pk_campaign, piwik_campaign, mtm_campaign, matomo_campaign, utm_campaign, utm_source, utm_medium)Ref: L3-394
Review