Follow

Details of the Personalize v1 JS release

 

Site Personalization Manager (SPM)

 

Changelog

v1

Changed all function definitions to fall into 4 functions: Sailthru.init, Sailthru.personalize, Sailthru.track, Sailthru.integration
Added unit test coverage tool
Added CDN integration tests
Improved browser compatibility

Function Overview

Sailthru.init({}) is required for any Sailthru functionality on the clients page

customerId: required - unique ID for client, can be found on the API Postbacks Setting Page
isCustom: required for custom option, defaults to false - must be true to fire a custom personalize call
useStoredTags: defaults to true - set to false use tags on the page instead of tags stored in Sailthru Content collection
excludeContent: defaults to false - set to true to stop spidering of this page
onSuccess: function fires when init call returns 2xx HTTP response
Simple: required to handle JSON Sections, returns response with all sections
Custom: returns { response: 'ok' } or response with all sections, this will always fire because custom init doesn't make an HTTP request
onError: function fires when init call returns 4xx or 5xx HTTP response
Simple: returns error response
Custom: N/A, no 4xx or 5xx HTTP response here
autoTrackPageview: defaults to true - set to false to track pageviews manually
Sailthru.personalize({}) is used to get personalized content using Custom option

sections: required - array of JSON objects (max 5 per call)
id: required - section id (UUID)
selector: required to automatically track impressions and clicks - CSS selector to replace and track
onSuccess: function fires when personalize call returns valid response for section
onError: function fires when error occurred with section
vars: page specific vars (will be used by every section in personalize call where var is used)
onSuccess: required to handle JSON Sections - function fires when personalize call returns 2xx HTTP response
onError: function fires when personalize call returns 4xx or 5xx HTTP response
autoTrackImpression: defaults to false - set to true to track impressions manually
autoTrackClick: defaults to TRUE - set to FALSE to track clicks manually

Sailthru.track(<function>, {}) is used to track user behavior manually (all track functions are done automatically by default)

Function pageview
url: required
useStoredTags
tags
onSuccess
onError

Function impression
sectionId: required
urls
onSuccess
onError

Function click
sectionId: required
url: required
onSuccess
onError

Sailthru.integration(<function>, {}) is used to help clients fire Sailthru events from their website

Function userSignUp
email: required
source: required if lists or vars not present
lists: required if vars or source not present
vars: required if lists or source not present
onSuccess
onError

Function addToCart
email: required
items: required
sku or url required
reminder_template
reminder_time
onSuccess
onError

Function purchase
email: required
items: required
sku or url required
purchase_keys
onSuccess
onError

Function customEvent
name: required - name of the customEvent to fire
id: required
key: required if id is not an email
vars
onSuccess
onError

Top