# Path Lens Settings

The Path Lens adds to or sets the value of a Visitor Profile attribute based on data that is present in the URL of a web page. Path Lenses allow marketers to define a URL pattern that must be matched before the lens is evaluated. If the page URL matches the pattern, the lens will attempt to collect the defined path parts. Path parts are parsed using the path in the URL and are indexed starting at 1. For example, the URL https://www.domain.com/category/mens/jeans has the following path parts:

1. category
2. mens
3. jeans

## Example

Using the above URL as an example. the Path Lens configuration below would set the following Visitor Profile attributes:

- CATEGORY_VIEWS - append the value mens to the collection attribute
- LAST_VIEWED_CATEGORY - sets the value mens to the attribute
- SUBCATEGORY_VIEWS - append the value jeans to the collection attribute
- LAST_VIEWED_SUBCATEGORY - sets the value jeans to the attribute

### Path Lens Configuration Example

    {
        type: "path",
        urlPattern: "https://www.domain.com/category/*",
        pathParts: [
            {
                index: 2,
                realtimeParameter:
                {
                    name: "CATEGORY_VIEWS",
                    isListParam: true,
                    trackLastViewed: true,
                    lastViewedParameterName: "LAST_VIEWED_CATEGORY"
                }
            },
            {
                index: 3,
                realtimeParameter:
                {
                    name: "SUBCATEGORY_VIEWS",
                    isListParam: true,
                    trackLastViewed: true,
                    lastViewedParameterName: "LAST_VIEWED_SUBCATEGORY"
                }
            }
        ]
    }

## Path Lens Properties

Property Name | Type | Description
--- | --- | ---
type | string | Must be set to path for Path Lenses
id | string | Optional. The id for the Path Lens
name | string | Optional. The name for the Path Lens
urlPattern | string | The url pattern to match for the Path Lens. The Path Lens will only evaluate if the urlPattern is matched. (e.g. https://www.domain.com/category/*)
pathParts | Array<PathPart> | The PathParts to save as a Realtime Parameter for the Path 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

### PathPart

Property Name | Type | Description
--- | --- | ---
index | number | The index of the url path part to be stored as the Realtime Parameter value. The url path part index starts at 1
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 ""