Choose if want to tracked by campaign

Good morning,

I want to allow users choose if they want to be tracked by campaign or not. The visit has to be saved in both cases.

For example, I visit the web page:
http://localhost:7800/index88.html?mtm_campaign=campanya1&mtm_kwd=c1&mtm_source=newsletter&mtm_medium=SEM&mtm_content=as1&mtm_cid=c1&mtm_group=gr1&mtm_placement=cp1

and I don’t want to be campaign traked, matomo shoud save my visit information in matomo_log_visit but with then fields campaign_keyword, campaign_medium, campaign_name, campaign_source, campaign_content and campaign_id to null.

On the other hand, if I visit the same web page and I allow to be campaig traked, matomo should save my visit information in matomo_log_visit with the campaing_* fields full.

Is there any flag or any way to do this?

Thank you and best regards,

Jordi Isidro-Llobet

Not sure it can be done easily…
But I have a question: Why would users be tracked, but not with campaign… Are you sure the campaign can be considered as personal data? If not (what I believe), then the rule for being tracked or not should be the same than the rule for tracking the campaign or not…

Hi @heurteph-ei
We have different levels of privacy and one of them is if the users want to be tracked by campaigns.
Now we have an event and variable in tag manager that tells us if they want to be campaign tracked or not and if not we make an update to the database in order to put the campaign to null, but is quite dirty…

What happens if you transforms the tracking URL in MTM (using the Custom URL property of the tag)?

As first approach (in a test version), you can set a static value of the Custom URL. Not sure it could work or not…

Yes, it can be done with the MTM, but I lost the campaigns information in matomo pannel.
Thanks for your solution!

If my providing clue is working, then you have to improve the Custom URL field:
Instead of putting a static value, you should use an MTM variable of type JavaScript function, that will provide the full path (with campaign) when authorized, and extract the path without some parameters in other cases…