Set Custom Campaign Source, Medium, Content values

I am probably just blind… The article here How can I customize Piwik PRO campaign parameters? | Piwik PRO help center shows how to set custom campaign parameter values (eg when they cannot be retrieved 1-1 from URL parameters). However, it doesn’t show it for campaign source, campaign medium and campaign content:

_paq.push(['setCampaignNameKey', 'new name']);
_paq.push(['setCampaignKeywordKey', 'new name']);

What are the respective push parameters for those?

Hi @loldenburg,

There is no method to change those via the command queue.

You can however alter the URL you send to Piwik, in case you encounter a URL that you want to track as a campaign parameter.

In that case you would use this: How can I customize Piwik PRO campaign parameters? | Piwik PRO help center

Could you provide me with an example of one of those URLs you are parsing?


1 Like

Thanks. Why would Piwik Pro offer to set a manual campaign name and keyword, but not the other parameters? That’s like stopping in the middle of the road…

I cannot parse them from the URL, or let’s say what comes through with the URL needs to be changed via JS first before tracking it to PP.

So the only option I have is to create a “fake” virtual URL with all these parameters as utm_source/utm_medium/utm_campaign I guess?

Yeah, it is a thing from the past.

Traditionally there was just the campaign name and campaign keyword dimension.
It never came up to support your method of setting it up like this.

Ppl have always been using either UTM_, PK_, or some other URL parameter in campaign links. all those use cases are covered bij Piwik PRO.

I don’t know what your use-case is, so it’s hard to say what solution would be your best fit.

The feature you refer to as ‘fake’ virtual URL is the command setCustomUrl (API — Piwik PRO Analytics Suite 18.7 documentation)
You call it before pushing the pageview command.

Oh by the way,

The code you are using is not setting the campaign name, you would see in the reports, but to tell Piwik PRO that a URL parameter, having the value ‘new name’ would be used to recognise the campaign name, based on the URL parameter, having the same key.

_paq.push(['setCampaignNameKey', 'mycustomcampaignname']);
_paq.push(['setCampaignKeywordKey', 'mycustomcampaignkey']);

would trigger the campaign specialoffer and keyword heatingsystem
When a visitor enters the site by this URL:

It would be a similar result as using a URL, having ‘standard’ UTM campaign tagging

I was not sure if you understood the function of the command setCampaignNameKey and setCampaignKeywordKey and wanted to make sure you are not building something that would not work for your use-case.

1 Like

Alright makes sense. Then the only way is hack the URL. Thanks @rmastop (Are you the founder of Mastopon?)

@kuba I think that could be a sensible improvement: Allow customers to set campaign parameters manually. In Adobe for example, you can set anything to s.campaign (e.g. the value of utm_campaign or a concatenation of all UTM parametrs or the name of your grandma). That can be very convenient (eg. when some tools do not support certain parameters or/and you need to combine values from multiple URL parameters into one campaign name).

1 Like

I marked @rmastop’s last comment as the “solution”, because it sufficiently answers my question, but it does not solve my problem, so it is not really a “solution”. Still, very grateful for your help, Richard!