# Storage Lens Settings

The Storage Lens adds to or sets the value of a Visitor Profile attribute based on data that is present in storage items accessible on a web page. Storage items can be either a browser cookie or Local Storage object. Storage Lenses allow marketers to specify the storage item type and lookup key to define the storage item value that should be collected when encountered on a page view.

## Example

Assuming a web page contains a cookie named shoppingCartId with a value of 987654321 and a Local Storage object with a value of 24867cb9-f5bb-4390-be40-27e7ac76f7ef, the Storage Lens configuration below would set the following Visitor Profile attributes:

- CART_ID - sets the value 987654321 to the attribute. The Local Storage lens will be evaluated up to 5 times with a 2.5 second delay between attempts until the lens collects a value.
- CUSTOMER_KEY - sets the value 24867cb9-f5bb-4390-be40-27e7ac76f7ef to the attribute

### Storage Lens Configuration Example

    {
        type: "storage",
        storageType: "cookie",
        lookupKey: "shoppingCartId",
        realtimeParameter:
        {
            name: "CART_ID",
            isListParam: false
        },
        retry: true,
        retryCount: 5,
        retryDelayMs: 2500
    },
    {
        type: "storage",
        storageType: "localstorage",
        lookupKey: "customerKey",
        realtimeParameter:
        {
            name: "CUSTOMER_KEY",
            isListParam: true
        }
    }

## Storage Lens Properties

Property Name | Type | Description
--- | --- | ---
type | string | Must be set to storage for Storage Lenses
id | string | Optional. The id for the Storage Lens
name | string | Optional. The name for the Storage Lens
storageType | string | The type of storage item to lookup. Valid values are cookie or localstorage
lookupKey | string | The name of the cookie or localstorage item
realtimeParameter | LensParameter | The LensParameter settings for the Realtime Parameter
retry | boolean | A flag to specify whether to attempt retries should the storage item not be found on page load. This option should be used if the storage item isn't guaranteed to be available on page load
retryCount | number | Optional. The maximum number of retry attempts to perform. Used when retry is true. Defaults to 10
retryDelayMs | number | Optional. The number milliseconds to wait between retry attempts. Used when retry is true. Defaults to 1000

### 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 ""