Lens configuration definitions
This topic defines the information required to configure any lens in the RPI web client.
Specific lens details
Some parameters are only used by specific lenses. Every lens requires the realtimeParameter
object to be defined.
JavaScript lens
JS
{
type: "javascript", // activateJsLens
objectName: "string", /* REQUIRED
JavaScript object name to save in the lens.
See https://developer.mozilla.org/en-US/docs/Web/API/Window
for more details.
*/
realtimeParameter: {} // REQUIRED
}
Search lens
CODE
{
type: "search", // activateSearchLens
searchParameter: "string", /* REQUIRED
Key to find value from in this.location.searchParts[searchParameter].
See parseUri() for details on how URL is parsed to create this.location
*/
realtimeParameter: {} // REQUIRED
}
Path lens
CODE
{
type: "path", //activatePathLens
pathParts:
[
{
index: integer, /* REQUIRED
Index of this.location.pathParts from which to take value.
See parseUri() for details on how URL is parsed to create this.location
*/
realtimeParameter: {} // REQUIRED
}
],
urlPattern: "string", /* REQUIRED
Regex pattern for which the URI must match to save this lens.
Is modified by parseMatchPattern.
Should take form of "https://yourURLhere.com/"
*/
realtimeParameter: {} // REQUIRED
}
Form lens
CODE
{
type: "form", // activateFormLens
formNameOrId: "string", /* OPTIONAL
String to identify target form.
Uses document.getElementById(nameOrId) then
document.getElementsByName(nameOrId)[0].
*/
formIndex: integer, /* REQUIRED if not using formNameOrId
Index of the form who's value to return.
Will return values from the nth form on the page based on document.forms[index].
Takes precedence over formNameOrId
*/
formInputs:
[
{
inputNameOrId:"string", /* REQUIRED
Form child element from which the lens value should be pulled.
*/
realtimeParameter: {} // REQUIRED
}
]
},
DOM lens
CODE
{
type: "dom", //activateDomLens
selectors: "string", /* REQUIRED
The DOM selector from which a value should be taken. For more details see:
https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll
*/
index: integer, /* DEFAULT: 0
Index of the element who's value to return. For an index of 3,
the lens will return the value of the 3rd HTML element matching the selectors.
*/
attribute: "string", /* DEFAULT: textContent
HTML attribute to return.
https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute
*/
realtimeParameter: {} // REQUIRED
},
Storage lens
CODE
{
type: "storage", // activateStorageLens
storageType: "string", /* DEFAULT: cookie
"localstorage" is only valid override.
*/
lookupKey: "string", /* REQUIRED
The item from localstorage or the name of the cookie
to be saved in the lens.
*/
realtimeParameter: {} // REQUIRED,
}
Generic parameters
There are also parameters that can be used in any of the lenses.
realtimeParameter
CODE
realtimeParameter:
{
name: "string", /* REQUIRED
Fieldname in the visitor profile under which
the lens value should be saved.
*/
isListParam: undefined, /* OPTIONAL true/false
If undefined, will be overidden based on config.realtimeListParameters.
Splits the lens value into an array based on comma separation. This array is appended to the visitor profile.
*/
trackLastViewed: true, /* OPTIONAL
Should lastViewedParamterName be used?
*/
lastViewedParameterName: "string", /* OPTIONAL
Fieldname of a visitor profile parameter than can store the last updated lens value.
Often used in conjunction with isListParam
*/
valueMapEnabled: false, /* OPTIONAL
Should valueMap be used?
*/
valueMap: {}, /* OPTIONAL
Used to replace the value found by the lens with a standardized
value. E.g. If all variations of the name "John" should be replaced
with "Jon" you would pass in a valueMap like this:
{
"John":"Jon",
"Jonathan":"Jon",
"Johnathan":"Jon"
}
*/
isStrictValueMap: false, /* OPTIONAL
Set to true if the lens value is only to be returned
if it is found in valueMap.
*/
}