1. @sitecore-cloudsdk/events/server

PageViewData

Version:

Type

Interface

Extends

EventAttributesInput

Import path

@sitecore-cloudsdk/events/server

Data for VIEW events.

Signature

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

Properties

Name

Type

Description

Value

pageVariantId

string

Optional.

The ID of a personalized page variant.

"page_variant_3"

referrer

string

Optional.

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

includeUTMParameters

boolean

Optional.

Whether to add every UTM parameter from the URL of the current webpage to the event object.

Default: true.

true

extensionData

ExtensionData

Optional.

Any custom data to collect about an event in addition to the other attributes provided for the event data.

{ customKey: "customValue" }

searchData

NestedObject

Optional.

Important

Requires 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 49. 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!