Set Campaign Values Manually

Quick suggestion, I had need to manually set Campaign Keyword myself, as I am actually using it to track internal split tests. In our use, the campaign was our test, the keyword was our variant.

The issue was that we only pass the campaign (test) through the Get string - our variant is decided based on optimization algos server side when the page is requested, so I had no key to pass to setCampaignKeyword.

I added configCampaignName and configCampaignKeyword and my own setters, and just modified the getRequest method to check those before checking the attributionCookie.

Figured it was worth bringing up as a feature request as others may have interest in being able to set these values manually as well - that, and if your team implements it, I dont have to worry about updates breaking my code :]

What is the feature request exactly?

Sorry for being unclear.

Feature request would be for setters to explicitly set the value of Campaign names and/or Campaign keywords - not just the keys of get params, as currently possible in the JS API and php config. In cases where we might want to override what’s in the url, or the value just isnt in the url to begin with.

ie, piwikTracker.setCampaignName[b]Value/b;

kmfk, that’s a reasonnable feature request.
Alternatively, I think you can use setCustomUrl( window.location.href + “&pk_campaign=test” );

Didn’t catch this til now. Clever, thanks Matt.