The campaign
variable is dedicated to collecting tracking codes on your site. In previous versions of Adobe Analytics, it had special treatment where it could be used as a breakdown to most dimensions. In the current version of Adobe Analytics, it acts identical to an eVar.
This variable populates the ‘Tracking Code’ dimension.
Campaign is mapped for Adobe Analytics under the XDM field marketing.trackingCode
.
You can set campaign either while configuring the Analytics extension (global variables) or under rules.
You can set campaign to a value or a query string parameter.
The s.campaign
variable is a string that typically contains a tracking code used in marketing efforts. Its max length is 255 bytes; values longer than 255 bytes are automatically truncated when sent to Adobe.
// Set the campaign variable to a static value
s.campaign = "abc123";
// Collect the cid query string parameter value from the URL
// https://example.com?cid=abc123
s.campaign = s.Util.getQueryParam("cid");