Using the RTP User Context API

John_M
Marketo Employee
Marketo Employee

Quite a few people have asked recently what a good use case is for using RTP's User Context API, Document here on the developer site.

At a high level, what the User Context API allows us to do is store bits of information about a (typically anonymous) user within RTP, and then leverage those bits of information for segmentation. Obviously RTP's set of data about an anonymous user is rich, but there could be custom items we might not return. Here are some examples:

  1. RTP doesn't return longitude and latitude, but other 3rd party products might. If that's important in the context of a campiagn, you could choose to store those in two "custom" variables
  2. RTP doesnt know if an anonymous visitor is a customer... but other 3rd party products might. In that case, you could use that 3rd parts's API to get that information, store it in a custom variable.. then segment on it.

When you're building your segment, here's how you use all this information

Step 1: Look under API for User Context API

Unknown.pngStep 2: Drag over User Context API

Unknown-1.png

Step 3: Choose the custom variable you're storing your data in

Unknown-2.png

Step 4: Choose the value in the fiedl you want to segment on!

Unknown-3.png

Unknown-4.png

You can then create a campaign based on this segment and serve up the right content to the right people! The User Context API is not on by default.. so talk to your support rep to get that enabled.

Its important to note that the custom fields in RTP are actually named "Custom 1" - "Custom 5". Whatever data you get from your other source is just placed in a variable with that name, then used.

2746
4
4 Comments
Anonymous
Not applicable

Helpful post!

Anonymous
Not applicable

Thanks John Mattos (W)​ for this post.

Elsewhere I've read that the User Context API stores the visitor's browsing history for up to the last 10 visits related to Personalized campaign impressions and clicks and also any other custom variables set.

My understanding regarding campaign impressions and views is that we can only segment based on the last 10 behaviors. Therefore, if someone engaged with 11 campaigns and the first activity was a click on campaign A we wouldn't be able to segment based on that click. Is this correct?

However, I'm having a hard time understanding how it applies to the custom variables. If we have a custom variable that stores a value based on someone viewed products A, B, or C, how does this limitation come into play if the value is triggered on our end? I was told that the custom variables values are overwritten when a new value is passed. If this is true, then does the last 10 visits only apply to only campaign impressions and clicks? Or do the custom variables also store the last 10 values?

Kamaljeet_Kaur1
Level 2

How and where would the custom variable be created? Which values we are putting in here in custom variables? When I select custom variable (1-5) it does not populate anything in the text field? and where will the rtp(‘set’, ‘customVar'[1-5], my_custom_value); be added? Is it coded on the page where we want to show the campaign or placed sitewide or it is coded somewhere in Marketo?

Kamaljeet_Kaur1
Level 2