campaign

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 using the Web SDK

Campaign is mapped to the following variables:

  • XDM object: marketing.trackingCode
  • Data object: data.__adobe.analytics.campaign or data.__adobe.analytics.v0

Campaign using the Adobe Analytics extension

You can set campaign either while configuring the Analytics extension (global variables) or under rules.

  1. Log in to Adobe Experience Platform Data Collection using your AdobeID credentials.
  2. Click the desired tag property.
  3. Go to the Rules tab, then click the desired rule (or create a rule).
  4. Under Actions, click an existing Adobe Analytics - Set Variables action or click the ‘+’ icon.
  5. Set the Extension drop-down list to Adobe Analytics, and the Action Type to Set Variables.
  6. Locate the Campaign section.

You can set campaign to a value or a query string parameter.

s.campaign in AppMeasurement and the Analytics extension custom code editor

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");
recommendation-more-help
b4f6d761-4a8b-4322-b801-c85b9e3be690