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

utm_source

string

Identifier of the site that sent the traffic.

Example: domain.com

utm_medium

number

Identifier of the type of link used.

Example: ppc, cpcbanner, and email.

utm_campaign

number

Identifier of the specific promotion or strategic campaign.

Example: spring_sale

utm_term

number

List of search terms often separated by a + or plus sign.

Example: popular+latest

utm_content

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 PageController to set values, as shown in the following code block.

    RequestResponse
    import { 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');
    

Do you have some feedback for us?

If you have suggestions for improving this article,