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. It typically gets its value from a query string using the getQueryParam
utility method. However, your organization determines exactly how to set this variable.
Campaign is mapped to the following variables:
marketing.trackingCode
data.__adobe.analytics.campaign
or data.__adobe.analytics.v0
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");