This method sends custom events for tracking and real-time personalization. It can be used to send third-party data, or to trigger your own custom event based on the visitor behavior. Custom data events are counted once in a visitor’s session.
Parameter | Optional/Required | Type | Description |
‘send’ | Required | String | Method action. |
‘event’ | Required | String | Method name. |
customData | Required | String or Array | Custom data. |
Examples
Send Event using String for Custom Data:
1 2 |
var customData = {value: 'MyEvent'}; rtp('send', 'event', customData); |
Send Event using Array of Strings for Custom Data:
The custom data array can contain a maximum of 4 elements. If you need to send more than 4 elements, then call Send Event API repeatedly (with a maximum of 4 items) until all items are sent.
1 2 |
var customData = {value: ['MyEvent', 'download - example whitepaper']}; rtp('send', 'event', customData); |
Send Event Based on Button Click:
Marketo personalizes content on their website to web visitors who download a specific white paper. They do this by capturing the visitor’s click on the white paper download button, which sends a custom data event. RTP segments in real-time all visitors who clicked on the download white paper button, showing each visitor a personalized campaign offering 2 clicks later. This is achieved by displaying a another piece of content related to the white paper downloaded.
1 |
<button id="download-whitepaper" onclick="rtp('send', 'event', {value :'download - example whitepaper'})">Download</button> |