Customer Property Mapping

Customer Property Mapping

Overview

The Intilery platform's Customer Property Mapping feature allows creation of JavaScript functions on a per-event basis to update customer properties based on specific events.  For example, if a record of the most recent product a customer has added to their shopping basket, is required, a function associated with an add to basket event could be created that returns something like this:

{ "MostRecentProduct": "YELOW_TEAPOT" }

Assuming any values returned are defined as properties on the Customer entity, this will then update the MostRecentProduct property for that customer to be "YELLOW_TEAPOT.  The customer entity will be updated immediately with this new data.

An example of this function is shown below:


Example code:

function(event, customer) {
	return { "MostRecentProduct": "YELLOW_TEAPOT" };
}

Of course, rather than hard-coding "YELLOW_TEAPOT", a property from the event might be used, for example:

function(event, customer) {
	return { "MostRecentProduct": event["Product"]["SKU"] };
}

These JS functions have full read access to the event and customer objects.  To update the Customer entity, the function must return the desired properties as shown in the examples (as a JS object), it is not possible to write directly to the customer or event objects from these JS functions and have those updates persist.

NB: If a function returns a property which is not a configured property of Customer entity, it will be ignored.

Case & Type sensitivity

Case is important when accessing and setting properties on the return object and interrogating the customer and event objects.

  • When accessing properties of the event object which exist in the model, the keys should be cased as defined in the model, and the type will be determined according to the table below.
  • When accessing properties of the event object which do not exist in the model, the keys will be all UPPERCASED, and the JS Type will always be String.
  • When accessing properties of the Customer, the keys should be cased as defined for the property in the model, and the type will be determined according to the table below.
customer["Subscribed"]

Notes

  • Updates to the Customer properties are applied before reaching any programmes.
  • Any properties returned by the mapper will overwrite any customer properties specified by the incoming event if the key is the same.
  • Functions must return a JS object with properties that are modelled for Customer entity, or those returned values will be ignored.

Object Types

Intilery Property Type JS Type
Boolean Boolean
Currency String
String String
Image String
Url String
Date DateTime
DateTime DateTime
PhoneNumber String
Number Float
List Array
Object Object/Array

Still need help? Contact Us Contact Us