Skip to content
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

Refactor referrer detection to be more flexible / replaceable #20067

Open
sgiehl opened this issue Nov 30, 2022 · 12 comments
Open

Refactor referrer detection to be more flexible / replaceable #20067

sgiehl opened this issue Nov 30, 2022 · 12 comments
Labels
c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself. Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. Technical debt Issues the will help to reduce technical debt

Comments

@sgiehl
Copy link
Member

sgiehl commented Nov 30, 2022

Our current referrer detection is hard coded into the referrer plugin, without any possibility to hook into it.
This makes it hard for plugins to manipulate that part in a useful way as it's only possible to overwrite the detected values afterwards.

I would suggest to refactor the whole detection part into a more flexible design.

First proposal:

  • Separate classes for each referrer type detection (e.g. SearchEngine, Social, Campaign, ...), all implementing a certain abstract/interface
  • Some sort of registry class, where plugins can register new referrer types, replace already registered classes or change the order of detections
  • The referrer detection will then fetch all available detections from the registry and walk through all of them, to detect the referrer details.

Once this was implemented, we need to adjust the MarketingCampaignsReporting plugin, so it's detection uses the new possibilities.

refs L3-362

@sgiehl sgiehl added Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself. labels Nov 30, 2022
@sgiehl sgiehl added this to the For Prioritization milestone Nov 30, 2022
@tsteur
Copy link
Member

tsteur commented Dec 2, 2022

@sgiehl is this similar / related to #18511 ?

@sgiehl
Copy link
Member Author

sgiehl commented Dec 2, 2022

Yes. That should make it possible to fix that one

@Starker3
Copy link
Contributor

FYI this issue shows up in the visitor profile, visits log and in the reports. For example if you have segments that use a specific campaign property as the condition, the visit would be included but because of the bug the segment reports could show it as ‘Direct Entry’ or as a different campaign completely.

 This also means that the standard campaign reports could also be wrong, i.e. showing a higher number of direct entry even when a visitor actually entered through a campaign or showing as a potentially different campaign.

@mattab mattab modified the milestones: Impact Backlog, 5.2.0 Jan 9, 2023
@mattab mattab modified the milestones: 5.2.0, 5.1.0 Jan 30, 2023
@mattab
Copy link
Member

mattab commented Jan 30, 2023

@sgiehl Couple of questions:

@sgiehl
Copy link
Member Author

sgiehl commented Jan 30, 2023

@mattab I guess we could implement that in a way that it won't break BC. And yes, this should also allow to fix #18511

@Stan-vw
Copy link
Contributor

Stan-vw commented Sep 28, 2023

@mattab why is this tagged as 5.1.0, this doesn't sound like extremely high value to a large group of users. Perhaps you can help me understand what value this unlocks?

@Starker3
Copy link
Contributor

@Stan-vw Matt might have more to add here, but I believe the main reason this is 5.1.0 is because it'll be required to fix the related issue: #18511
Which currently might impact a large number of users, many of which likely won't even notice it unless they look closely between the reports and visits log.

@sgiehl
Copy link
Member Author

sgiehl commented Sep 28, 2023

@Stan-vw There might actually also be a couple more undiscovered bugs around campaign detection when using MarketingCampaignsReporting plugin. The problem is, that the detection in core and the plugin might differ, which could even end up in incorrect data being displayed. That might e.g. already be the case when core detects a campaign, while the plugin doesn't (or vice versa). I can explain that in detail in a quick call if you want.

@mattab
Copy link
Member

mattab commented Sep 29, 2023

Maybe to keep things simpler, @sgiehl @tsteur we could simply integrate the Marketing Campaign plugin into core and make the 5 dimensions part of the default functionality of Matomo? it might reduce some complexity, and wouldn't really impact users anyway...

@sgiehl
Copy link
Member Author

sgiehl commented Sep 29, 2023

@mattab Guess that would make some things easier, but we should still aim to refactor the referrer detection, as the current structure is quite complex to understand

@Stan-vw
Copy link
Contributor

Stan-vw commented Oct 4, 2023

@sgiehl would you recommend amending the scope you set out in the ticket with Matt's suggestion, or is there further work you're suggesting?
If it's the former, perhaps you can adjust the original post and we can plan the work as such 👍

@sgiehl
Copy link
Member Author

sgiehl commented Oct 5, 2023

Integrating the MarketingCampaignsReporting plugin to core will require some additional effort. There wouldn't be much benefit in simply shipping the plugin with core. To make code simpler and less error prone we need to restructure the referrer detection to be a bit more flexible (what this issue originally is about), we could then maybe move the campaign detection parts from referrer plugin to the integrated MarketingCampaignsReporting plugin, so all campaign related reporting would end up in that plugin.

@mattab mattab added the Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. label Dec 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself. Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. Technical debt Issues the will help to reduce technical debt
Projects
None yet
Development

No branches or pull requests

5 participants