Custom Data Events
Use this method to send custom events for tracking and real-time personalization. You can send third-party data or trigger a custom event based on visitor behavior.
Each custom data event is counted once during a visitor’s session.
You must be a Web Personalization customer and have the RTP tag deployed on your site before using the User Context API.
sendeventcustomDataExamples
Send Event using String for Custom Data
var customData = {value: 'MyEvent'};
rtp('send', 'event', customData);
Send Event using Array of Strings for Custom Data
The custom data array can contain up to four elements. To send more than four elements, call the Send Event API repeatedly with no more than four items in each call.
var customData = {value: ['MyEvent', 'download - example whitepaper']};
rtp('send', 'event', customData);
Send Event Based on Button Click
This example sends a custom data event when a visitor selects the button to download a specific white paper. RTP can use the event to segment those visitors in real time.
The website can then display a personalized campaign after two more clicks. For example, the campaign can present another piece of content related to the downloaded white paper.
<button id="download-whitepaper" onclick="rtp('send', 'event', {value :'download - example whitepaper'})">Download</button>