The value of Redpoint Realtime starts with a strong foundation of data collection. Redpoint Realtime Lenses provide developers with the ability to configure lenses to be evaluated on each page visit for the purpose of collecting visitor profile data. Lenses are evaluated on each page view during initialization of the RpiWebClient and any visitor data that is collected will be pushed to the visitor profile to inform decisioning and personalization.
There are several lens types that can be configured in RpiWebClient.
Path Lens
The Path Lens identifies parts of a web page path to be collected and stored as parameters in the Realtime profile.
Search Lens
The Search Lens identifies the query string parameters to be collected and stored as parameters in the Realtime profile.
Storage Lens
The Storage Lens identifies site cookies and local storage values to be collected and stored as parameters in the Realtime profile.
Javascript Lens
The Javascript Lens identifies javascript variables/objects values to be collected and stored as parameters in the Realtime profile.
Form Lens
The Form Lens identifies form field values to be collected and stored as parameters in the Realtime profile.
DOM Lens
The DOM Lens identifies elements of the DOM (Document Object Model) to be collected and stored as parameters in the Realtime profile.
Realtime Lenses are configured by defining a globally scoped variable of type LensConfig named rpiWebClientLensConfig. When RpiWebClient encounters this variable during initialization, the lenses configured in it are evaluated and any Realtime Parameters that are collected are pushed to the RPI Realtime visitor profile.
The rpiWebClientLensConfig variable can also be defined in the rpiWebClient.config.js file. When using rpiWebClient.config.js, it should be included before rpiWebClient-6.2.js on the page.
var rpiWebClientLensConfig = {
Lenses: [
{
type: "path",
urlPattern: "https://www.domain.com/*/",
pathParts: [
{
index: 1,
realtimeParameter:
{
name: "CATEGORY_VIEWS",
isListParam: true,
trackLastViewed: true,
lastViewedParameterName: "LAST_VIEWED_CATEGORY"
}
},
{
index: 2,
realtimeParameter:
{
name: "SUBCATEGORY_VIEWS",
isListParam: true,
trackLastViewed: true,
lastViewedParameterName: "LAST_VIEWED_SUBCATEGORY"
}
}
]
},
{
type: "form",
formIndex: 0,
formInputs: [
{
inputNameOrId: "username",
realtimeParameter:
{
name: "USERNAME",
trackLastViewed: false
}
}
]
}
]
};
Lens Parameters are used to configure the Realtime Parameters that Realtime Lenses will push to RPI Realtime. Lens Parameters allow developers to specify the Realtime Parameter name and type (value or collection). Lens Parameters also provide advanced options for specifying an additional "last viewed" parameter and value mapping. Each configured lens type will include one or more Lens Parameter configuration.
The Lens Parameter trackLastViewed property allows for the collection of an additional Realtime Parameter with the evaluated value of a Lens. This property is intended to be used when the isListParam property is set to true. When the isListParam and trackLastViewed properties are both set to true, two Realtime Parameters can be set by a single Lens configuration--a Collection Parameter with its name define by the name property and a single-value parameter with its name defined by the lastViewedParameterName property.
realtimeParameter:
{
name: "CATEGORY_VIEWS",
isListParam: true,
trackLastViewed: true,
lastViewedParameterName: "LAST_VIEWED_CATEGORY"
}
Lens Parameters provide value mapping capabilities to translate the evaluated value of a Lens. When the Lens Parameter valueMapEnabled property is set to true the Lens will attempt to look up the evaluated value defined in the valueMap property. The isStrictValueMap property determines whether values not found in valueMap will be pushed to the Realtime Visitor Profile and defaults to false
realtimeParameter:
{
name: "CATEGORY_VIEWS",
isListParam: true,
trackLastViewed: true,
lastViewedParameterName: "LAST_VIEWED_CATEGORY",
valueMapEnabled: true,
valueMap: new Map([["mens", "Men's"], ["womens", "Women's"], ["camp-hike", "Camp and Hike"],["cycling", "Cycling"],["accessories", "Accessories"]]),
isStrictValueMap: true
}
Property Name | Type | Description |
---|---|---|
name | string | The name for the Realtime Parameter |
isListParam | boolean | A flag to specify if the Realtime Parameter value is stored as a collection |
trackLastViewed | boolean | Optional. A flag to specify whether an additional Realtime Parameter will be stored with the current value from the Path Lens. Required when isListParam is true |
lastViewedParameterName | string | Optional. The name for the last viewed Realtime Parameter. Required when trackLastViewed is true |
valueMapEnabled | boolean | A flag to specify whether the value collected from the Path Lens should be translated through the valueMap |
valueMap | Map<string, string> | Optional. A Map of value translations for the values collected from the Path Lens. Required when valueMapEnabled is true |
isStrictValueMap | boolean | Optional. A flag to specify whether to use strict value map translations. When true, values not found in valueMap are not sent to RPI Realtime |