Thanks Dmitry, that was really helpful.
I've managed to get it working now by passing the URL parameters when making the request to set the cookie level and calling the CampaignService.SetCampaign method. This sets the various campaign cookies.
The subsequent call to the logger now includes the campaign values in the Activity table records so our statistics are accurate.
The problem with a lot of our campaigns is that traffic comes from social channels to a landing page where a user submits a form. This means that a lot of conversions are never tracked as a user bounces immediately after the form submits.
public ActionResult SetCookieLevel(int selectedValue)
CookieHelper.SetValue(CookieLevelName, selectedValue.ToString(), DateTime.Now.AddYears(1));
// if cookie level is visitor or above, set campaign parameters if they exist for accurate campaign tracking
if (selectedValue >= CookieLevel.Visitor)
var campaignCode = Request["utm_campaign"];
var campaignSource = Request["utm_source"];
var campaignContent = Request["utm_content"];
// set campaign cookies
CampaignService.SetCampaign(campaignCode, SiteContext.CurrentSiteName, campaignSource, campaignContent);
return new HttpStatusCodeResult(HttpStatusCode.OK);