Hello everyone. I need to add custom campaign names (i.e. lead_src) and keywords (i.e. promo_code), but maintain Matomo’s defaults (i.e. pk_cpn,pk_campaign,piwik_campaign, etc…) and GA defaults (utm_campaign,utm_source,utm_medium).
I followed the instructions on How do I customize the Matomo Campaign parameters pk_campaign and pk_kwd?, and particularly, the Notes section it says:
these two functions also accept an array of strings. If an array of names is specified, the first non empty campaign or keyword parameter value will be selected.
So I went ahead and:
1) Override the parameters in the config file
My config/config.ini.php now has this portion of code:
[Tracker] campaign_var_name = "lead_src,promo_code,pk_cpn,pk_campaign,piwik_campaign,mtm_campaign,matomo_campaign,utm_campaign,utm_source,utm_medium" campaign_keyword_var_name = "promo_code,pk_kwd,pk_keyword,piwik_kwd,mtm_kwd,mtm_keyword,matomo_kwd,utm_term"
But my issue/question comes with the second instruction:
_paq.push(["setCampaignNameKey", [ "lead_src", "promo_code", "pk_cpn", "pk_campaign", "mtm_campaign", "piwik_campaign", "matomo_campaign", "utm_campaign", "utm_source", "utm_medium" ]]); _paq.push(["setCampaignKeywordKey", [ "promo_code", "pk_kwd", "mtm_kwd", "piwik_kwd", "matomo_kwd", "utm_term" ]]);
I searched quite a while before posting this topic, seems this shows a hint: Wird hier anonym geloggt? (code inside!). Also /4.4.1/js/piwik.js shows
setCampaignNameKey function as receiving a single
string OR an
Hope someone can confirm or correct where wrong. Thanks!