UTM parameters
The context object in a request describes the location and visitor requesting data. The values in the object are used to select which rules are applied during search.
This topic describes how to add Urchin Tracking Module (UTM) parameters to the context object of requests in Sitecore Search JavaScript SDK for React.
The following table lists the UTM parameters used to describe marketing campaigns. If you want to use any of these parameters, you must also include utm_source. All of the other parameters are optional.
|
Property |
Type |
Description |
|---|---|---|
|
|
string |
Identifier of the site that sent the traffic. Example: domain.com |
|
|
number |
Identifier of the type of link used. Example: ppc, cpc, banner, and email. |
|
|
number |
Identifier of the specific promotion or strategic campaign. Example: spring_sale |
|
|
number |
List of search terms often separated by a + or plus sign. Example: popular+latest |
|
|
number |
Identifier of what specifically was clicked to bring the user to the site. Example: logolink and callToAction. |
To add UTM parameters as context:
-
Use
PageControllerto set values, as shown in the following code block.RequestResponseimport { PageController } from '@sitecore-search/react'; const context = PageController.getContext(); context.setUtmSource('utm source'); context.setUtmMedium('utm medium'); context.setUtmCampaign('utm campaign'); context.setUtmTerm('utm term'); context.setUtmContent('utm content');