Triggers

Triggers run functions when the global rtp object reaches a specified state.

You must be a Web Personalization customer and have the RTP tag deployed on your site before using the User Context API.

Usage

rtp('triggerName', function_to_trigger);

Parameter
Optional/Required
Type
Description
‘triggerName’
Required
String
Method name.
function_to_trigger
Required
Function
Function to trigger.

User Context Ready Trigger

The userContextReady trigger calls a function when the global rtpUserContext object is ready. The following example sets a custom variable based on the user’s location.

rtp('userContextReady', function() {
    if (rtpUserContext.location.state == 'CA') {
        rtp('set', 'custom1', 'productA');
    }
});
recommendation-more-help
marketo-developer-help