1. Interfaces

PageViewData

Version:
TypeInterface
ExtendsEventAttributesInput
Import path@sitecore-cloudsdk/events/browser

Data for VIEW events.

Signature

export interface PageViewData extends EventAttributesInput {
  pageVariantId?: string;
  referrer?: string;
  includeUTMParameters?: boolean;
  extensionData?: ExtensionData;
  searchData?: NestedObject;
}

Properties

NameTypeDescriptionValue
pageVariantIdstringOptional.The ID of a personalized page variant."page_variant_3"
referrerstringOptional.The URI of the webpage that linked to the webpage where the event was captured.Default for browser-side events: inferred from document.referrer. If document.referrer is an empty string, the value will be set to null.Default for server-side events: null."https://www.example.com/"null
includeUTMParametersbooleanOptional.Whether to add every UTM parameter from the URL of the current webpage to the event object.Default: true.true
extensionDataExtensionDataOptional.Any custom data to collect about an event in addition to the other attributes provided for the event data.{ customKey: "customValue" }
searchDataNestedObjectOptional.ImportantRequires a Sitecore Search subscription.Sitecore Search data about the event.If set, the event and all its data will be available in Sitecore Search.Construct according to the Sitecore Search Events API reference and data model.N/A

Examples

Example 39. VIEW event with optional data

Here's an example event data object for a VIEW event with optional event data and extension data:

const eventData: any = {
  language: "EN",
  page: "home",
  channel: "WEB",
  currency: "EUR",
  pageVariantId: "page_variant_3",
  extensionData: {customKey: "customValue"}
};

By default, VIEW events include UTM parameters. Consider the following URL:

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

A VIEW event captured on the previous URL will contain all the UTM parameters in the event data:

{
  "language": "EN",
  "page": "home",
  "channel": "WEB",
  "currency": "EUR",
  "pageVariantId": "page_variant_3",
  "extensionData": "{'customKey': 'customValue'}",
  "utm_source": "newsletter",
  "utm_medium": "email",
  "utm_campaign": "summer_sale",
  "utm_term": "running shoes"
}
If you have suggestions for improving this article, let us know!