Triggering a campaign

Current version: 10.2

A campaign is a promotion or advertising initiative that is represented by a definition item in Sitecore, and is often associated with a landing page. There are three ways to trigger a campaign:

The following logic applies when a visitor triggers a campaign:

  • If the campaign is triggered on the landing page (the first page of the interaction):

    • Set the tracker interaction's Tracker.Current.Session.Interaction.CampaignId.

    • On session end, set the xConnect interaction's Sitecore.XConnect.Interaction.CampaignId and add a CampaignEvent object to the interaction's Sitecore.XConnect.Interaction.Events collection.


    The CampaignId property is only set it if it is empty. If you trigger multiple campaigns on the landing page, the CampaignId property represents the campaign that was triggered first.

  • If the campaign is triggered on a subsequent page, add a campaign PageEventData to the tracker interaction. On session end, add a CampaignEvent to the xConnect interaction's Sitecore.XConnect.Interaction.Events collection. The CampaignId property is not set.

Understanding campaign data in reporting interfaces

The Experience Analytics (xAnalytics) reports rely on aggregated data in the xDB Reporting database. The interaction aggregation pipelines only process interaction-level campaigns (represented by the Sitecore.XConnect.Interaction.CampaignId property), which means that campaigns triggered on the second or subsequent pages of an interaction are not included in the aggregated reporting data.

Troubleshoot campaigns

To check whether a campaign is being triggered in the xDB Collection SQL provider:

  1. In SQL Management Studio, expand an xDB Collection database shard (for example,[yourproduct]_Xdb.Collection.Shard[X]).

  2. Select the top X rows of the xdb_collection.Interactions table.

  3. Locate the CampaignId and Events columns.

    • If the CampaignId column has a value, the campaign was successfully triggered on the first page of the interaction. The same campaign is represented in the Events column JSON. This data is included in the xAnalytics campaign reports.

    • If the CampaignId column is NULL, any campaign that was successfully triggered on the second or subsequent pages is represented in the Events column JSON. This data is not used in the xAnalytics campaign reports.

    If the campaign is not represented in the Events column or the CampaignId column, it has not been triggered.

If a campaign has not been triggered:

  • Ensure that you have published and deployed the campaign definition item to the Reference Data database.

  • If you are using a query string to trigger the campaign, ensure that you are using the correct query string key. The Analytics.CampaignQueryStringKey setting is located in the App_Config\Sitecore\Marketing.Tracking\Sitecore.Analytics.Tracking.config configuration file by default:

    <setting name="Analytics.CampaignQueryStringKey" value="sc_camp" />

    If you are using patch files to change your configuration, use the /sitecore/admin/showconfig.aspx interface to check the final value of the Analytics.CampaignQueryStringKey setting.

Do you have some feedback for us?

If you have suggestions for improving this article,