Form Lens Settings

The Form Lens adds to or sets the value of a Visitor Profile attribute based on data that is entered in HTML form fields. Form Lenses allow marketers to specify the form fields values within a form that should be collected when changed in the browser.

Example

Assuming a web page contains the HTML in the example below, the Form Lens configuration below would set the following Visitor Profile attributes:

  • EMAIL - sets the entered value to the attribute when the email input field is updated
  • PHONE - sets the entered value to the attribute when the phone input field is updated

HTML Example

<form id="newsletter-form">
    <label>Name:</label> <input type="text" name="name" />
    <label>Email:</label> <input type="text" name="email" />
    <label>Phone:</label> <input type="text" name="phone" />
<form>

Form Lens Configuration Example

{
    type: "form",
    formNameOrId: "newsletter-form",
    formInputs: [
        {
            inputNameOrId: "email",
            realtimeParameter:
            {
                name: "EMAIL",
                isListParam: false
            }
        },
        {
            inputNameOrId: "phone",
            realtimeParameter:
            {
                name: "PHONE",
                isListParam: false
            }
        }
    ]
}

Form Lens Properties

Property Name Type Description
type string Must be set to path for Form Lenses
id string Optional. The id for the Form Lens
name string Optional. The name for the Form Lens
formNameOrId string Optional. The name or id of the HTML form to target. A valid Form Lens configuration must specify either nameOrId or index
index number Optional. The index of the HTML form to target. A valid Form Lens configuration must specify either nameOrId or index
formInputs Array<FormLensInput> The Form Lens Inputs to save as a Realtime Parameter for the Form Lens
timeoutMs number Optional. A timeout in milliseconds. When specified, the Path Lens will wait the specified number of milliseconds after the RpiWebClient is initialized before evaluating the Path Lens

FormLensInput

Property Name Type Description
inputNameOrId string The name or id of the form input field to listen for changes on
realtimeParameter LensParameter The LensParameter settings for the Realtime Parameter

LensParameter

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

results matching ""

    No results matching ""