1. Interfaces

PersonalizeData

Version:
TypeInterface
Import path@sitecore-cloudsdk/personalize/browser

Event and experiment data for running interactive experiences and experiments that are live in Sitecore Personalize.

Signature

export interface PersonalizeData {
  channel: string;
  currency?: string;
  email?: string;
  friendlyId: string;
  geo?: PersonalizeGeolocation;
  identifier?: PersonalizeIdentifierInput;
  language?: string;
  params?: PersonalizeInputParams;
  pageVariantIds?: string[];
}

Properties

NameTypeDescriptionValue
channelstringRequired.The touchpoint where the user interacts with your brand.For example, for webpages, the channel is "WEB". For mobile app screens, the channel is "MOBILE_APP".Format: uppercase.Must be one of:"AIRPORT_KIOSK""BRANCH""CALL_CENTER""EMAIL""GDS""KIOSK""MOBILE_APP""MOBILE_WEB""SMS""OFFLINE""OTA""OTHER""WEB"
currencystringOptional.The alphabetic currency code of the currency the site visitor uses in your app.For example, if the site visitor selects Australian dollars as the currency, the currency is "AUD".Format: uppercase ISO 4217."EUR""GBP""USD"
emailstringOptional.The site visitor's email address.Format: lowercase recommended."[email protected]"
friendlyIdstringRequired.The unique identifier of the live interactive experience or experiment to run.To find the friendly ID in Sitecore Personalize, click the live experience or experiment to run, then click Build summary. The friendly ID is in the Details pane."running_shoes_popup_02"
geoPersonalizeGeolocationOptional.The site visitor's geolocation data.geo: { city: "Dublin", country: "IE", region: "Leinster" }
identifierPersonalizeIdentifierInputOptional.The identifiers used for identifying site visitors.If set, the experience or experiment runs only for the identified site visitor.identifier: [{ id: "123456", provider: "BXLP" }]
languagestringOptional.The language the site visitor interacts with your brand in.For example, if the site visitor selects the Japanese language in your app, the language is "JA".Format: uppercase ISO 639.Default for browser-side events: inferred from the HTML lang attribute. If lang is not specified, the default is an empty string.Default for server-side events: empty string."DE""EN""FR"
paramsPersonalizeInputParamsOptional.An object of your choice.If the URL of the webpage where this function runs contains UTM parameters, those parameters are automatically captured in params.utm.To override the automatically captured UTM parameters, specify values manually in params.utm.params: { customKey: "customValue" }
pageVariantIdsstring[]Optional.A list of IDs of personalized page variants.Ensures that the correct variants are rendered for personalization.If unset or an empty array, this property will not be part of the payload.["page_variant_3", "page_variant_5"]

PersonalizeGeolocation properties

NameTypeDescriptionValue
citystringOptional.The site visitor's city address.Format: title case recommended."Dublin"
countrystringOptional.The site visitor's country address.Format: uppercase ISO 3166-1 alpha-2."IE"
regionstringOptional.The site visitor's region address.Depends on the regional structure of the country.Format: for example, for Australia, use state and territory abbreviations. For the United States, use ANSI standard INCITS 38
.
"Leinster""Tas""CA"

PersonalizeIdentifierInput properties

NameTypeDescriptionValue
idstringRequired.

The unique guest (site visitor) identifier provided by your organization's identity system, such as a Customer Relationship Management (CRM) system.
"123456"
providerstringRequired.

The name of your organization's identity system, external to SitecoreAI, that provided the unique guest (site visitor) identifier.
"BXLP"

params.utm properties

NameTypeDescriptionValue
campaignstringOptional.

A product promotion or strategic campaign.
"summer_sale"
contentstringOptional.

The element the site visitor clicked that brought them to the website, such as a banner ad or a text link.
"textlink"
mediumstringOptional.

The type of link used, for example, pay-per-click or email.
"email"
sourcestringOptional.

The website that sent the traffic.
"newsletter"
termstringOptional.

Search terms the site visitor searched for.
"running shoes"

Examples

Example 58. Personalize data object with browser ID

Here's an example of a personalize data object that doesn't contain the email attribute or the identifier attribute to identify the guest (site visitor). In this case, the browser ID is the guest identifier. This personalize data object also contains an optional custom object.

const personalizeData = {
  channel: "WEB",
  friendlyId: "running_shoes_popup_02",
  // optional attributes:
  params: { key: "value" }
};

Example 59. Personalize data object with email

Here's an example of a personalize data object that uses the email attribute as the guest (site visitor) identifier.

const personalizeData = {
    channel: "WEB",
    friendlyId: "running_shoes_popup_02",
    // guest identifier:
    email: "[email protected]"
}

Example 60. Personalize data object with identifiers

Here's an example of a personalize data object that uses the identifier attribute as the guest (site visitor) identifier.

const personalizeData = {
    channel: "WEB",
    friendlyId: "running_shoes_popup_02",
    // guest identifier:
    identifier: {
        id: "123456",
        provider: "BXLP"
    }
}

Example 61. Personalize data object payload with UTM parameters

If the URL of the webpage where the personalize function runs contains UTM parameters, the payload of the personalize data object will contain the UTM parameters. Consider the following URL:

https://myretailsite.com?utm_source=newsletter&utm_medium=email&utm_campaign=summer_sale&utm_term=running+shoes

For this URL, the payload will contain all the UTM parameters in params.utm:

{
  "channel": "WEB",
  "friendlyId": "running_shoes_popup_02",
  "params": {
    "customKey": "customValue",
    "utm": {
      "source": "newsletter",
      "medium": "email",
      "campaign": "summer_sale",
      "term": "running+shoes"
    }
  }
}
If you have suggestions for improving this article, let us know!