Visit our new documentation site! This documentation page is no longer updated.

Personalization API with Marketo Web Personalization

You can integrate Treasure Data’s Personalization API with Marketo’s Web Personalization feature to provide fully personalized experience for your customers by leveraging all of your customer data.

Table of Contents


Step 1: Enable Marketo Web Personalization

First, make sure that you have access to Marketo’s Web Personalization feature. It is a Marketo add-on feature.

Step 2: Configure the Content

Click the Marketo logo and then click Web Personalization.

Click Segments.

Click Create New.

Set the segment number that you created in Treasure Data and the click Save.

Move to Campaign. (Click the Marketo logo and click Campaign.) Then, click Create New Web Campaign.

Select the segment name that you created previously and set the contents. (You can make Dialog, In Zone and Widget.)

Step 3: Implement JavaScript Tags

Step 3-1: Add Marketo RTP Tag

Load Market’s Web Personalizaition JavaScript tag into your page.

Here’s the example tag.

<!-- Marketo RTP tag -->
c[a].p=e;c[a].a=i;var g=h.createElement("script");g.async=true;g.type="text/javascript";
g.src=f;var b=h.getElementsByTagName("script")[0];b.parentNode.insertBefore(g,b)})
rtp('setAccount', 'YOUR_MARKETO_ACCOUNT_ID');

Step 3-2: Send Treasure Data’s Segment IDs to Marketo as User Context

Call Treasure Data’s Personalization API, and send the response to Marketo using the User Context feature of Marketo’s RTP tag.

Here’s the final outcome of this documentation.

<script type="text/javascript">
<!-- Marketo RTP -->
c[a].p=e;c[a].a=i;var g=h.createElement("script");g.async=true;g.type="text/javascript";
g.src=f;var b=h.getElementsByTagName("script")[0];b.parentNode.insertBefore(g,b)})
rtp('setAccount', 'YOUR_MARKETO_ACCOUNT_ID');

<!-- Treasure Data -->
!function(t,e){if(void 0===e[t]){e[t]=function(){e[t].clients.push(this),this._init=[]},e[t].clients=[];for(var r=function(t){return function(){return this["_"+t]=this["_"+t]||[],this["_"+t].push(,this}},s=["addRecord","set","trackEvent","trackPageview","trackClicks","ready","fetchGlobalID","fetchUserSegments"],a=0;a<s.length;a++){var c=s[a];e[t].prototype[c]=r(c)}var n=document.createElement("script");n.type="text/javascript",n.async=!0,n.src=("https:"===document.location.protocol?"https:":"http:")+"//";var i=document.getElementsByTagName("script")[0];i.parentNode.insertBefore(n,i)}}("Treasure",this);

// Configure an instance for your database
var td = new Treasure({
  host: '',
  writeKey: '[YOUR_WRITE_KEY]',
  database: '[YOUR_DB_NAME]'

// Enable cross-domain tracking
td.set('$global', 'td_global_id', 'td_global_id');

// Get segment number from TD and send it to Marketo's RTP
var successCallback = function(key, values) {
  rtp('set', 'customVar1', values.join(";"));

var errorCallback = function(err) {

var trackPageviewSuccessCallback = function(){
    keys: {
      key_column_1: 'someValue',
      key_column_2: 'someOtherValue',
  }, successCallback, errorCallback)

td.trackPageview([YOUR_TABLE_NAME], trackPageviewSuccessCallback);

Step 4: Confirmation

Now you can access to your website, and verify that the desired content is shown for you.

Last modified: Mar 22 2018 01:30:03 UTC

If this article is incorrect or outdated, or omits critical information, let us know. For all other issues, access our support channels.