User Context

User Context JavaScript API exposes user and visitor level data across multiple sessions to enable advanced personalization capability leveraging historical user behavior and data. The API goes beyond data read and exposes custom variables that allows you to push meaningful data and events to the RTP backend for advanced segmentation and personalization purposes. Additional capabilities: Triggers, Pattern Match.

  • You must become a Web Personalization customer and have the RTP tag deployed on your site prior to using the User Context API.
  • The User Context API must be enabled by an RTP admin user (contact your customer success representative for further assistance). When the API is enabled, a userContext object under the RTP global object will be exposed.

User Context Attributes

Name Type Description
customVar[1-5] String Custom data saved on user context.
viewedCampaigns Campaign ID’s as comma separated string Viewed campaigns in current or previous visits.
clickedCampaigns Campaign ID’s as comma separated string Clicked through campaigns in current or previous visits.

Set Custom Variables

Adding custom data to User Context.

Usage

rtp(‘set’, ‘customVar'[1-5], my_custom_value);

Parameter Optional/Required Type Description
‘set’ Required String Method action.
customVar Required String Custom varilable  name.
my_custom_value Required String Custom value to save on custom variable in index 1-5.

Note: Custom variables are sent to RTP only in view call, so it is recommended to set custom variables before view is called. Otherwise, it will be sent only in next view call.

Custom Var Restrictions

  • Custom variable length cannot be longer than 100 characters.
  • Campaign data is limited to the last 10 visits with 10 campaigns per visit.

Usage

rtp(‘set’, ‘customVar’, ‘A’);