{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"redocly_category":"Products","product_name":"Audience Studio","type":"markdown"},"seo":{"title":"Integrate TD Profiles API with Marketo Web Personalization","description":"Treasure Data Product Documentation · Collect and Unify · Segment and Activate · Experiment and Analyze · Decisioning Automate with AI Scale and Trust.","siteUrl":"https://docs.treasuredata.com","lang":"en-US","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"integrate-td-profiles-api-with-marketo-web-personalization","__idx":0},"children":["Integrate TD Profiles API with Marketo Web Personalization"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can integrate Treasure Data’s Profiles API with Marketo’s Web Personalization feature to provide fully personalized experience for your customers by leveraging all of your customer data."]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/audience-studio/profiles/integrate-td-profiles-api-with-marketo-web-personalization#prerequisites"},"children":["Prerequisites"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/audience-studio/profiles/integrate-td-profiles-api-with-marketo-web-personalization#integrating-td-profiles-api-with-marketo"},"children":["Integrating TD Profiles API with Marketo"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/audience-studio/profiles/integrate-td-profiles-api-with-marketo-web-personalization#configure-marketo-for-use-with-the-td-profile-api"},"children":["Configure Marketo for use with the TD Profile API"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/audience-studio/profiles/integrate-td-profiles-api-with-marketo-web-personalization#add-a-marketo-rtp-tag-and-treasure-data-tag"},"children":["Add a Marketo RTP Tag and Treasure Data Tag"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/audience-studio/profiles/integrate-td-profiles-api-with-marketo-web-personalization#examples"},"children":["Examples"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"prerequisites","__idx":1},"children":["Prerequisites"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Basic knowledge of JavaScript and HTML"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Basic knowledge of Treasure Data"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Basic knowledge of Treasure Data JavaScript SDK"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Basic knowledge of Treasure Data Profiles API"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Basic knowledge of ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://docs.marketo.com/display/public/DOCS/Understanding+Web+Personalization"},"children":["Marketo Web Personalization"]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Access to Marketo’s add-on Web Personalization feature."]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use of Treasure Data JavaScript SDK might require the direction of Treasure Support or Services team."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"integrating-td-profiles-api-with-marketo","__idx":2},"children":["Integrating TD Profiles API with Marketo"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Complete the steps in the following sections to integrate the TD profiles API with Marketo:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Configure Marketo for use with the TD profile API"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Create JavaScript DFP and Treasure Data Tags"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"configure-marketo-for-use-with-the-td-profile-api","__idx":3},"children":["Configure Marketo for use with the TD Profile API"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Open Marketo."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Select the Marketo icon."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Select Web Personalization."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/image-20190829-000347.ffb085130c7b0a84ff1dd699dc588a7ade40a267fce6e108df1b463b48fd6409.cf3845cb.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Select Segments."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/image-20190829-000239.99622038b8e54f1e82d7b1f7b9c32366541eb8e0fc04ebad62633d6022c68a59.cf3845cb.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Select Create New."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/image-20190829-000032.8506b4d8da21bb63f5ec1f0efb32e8ced4217c77463ef9aa3d4e88688c391c94.cf3845cb.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Specify the segment number that you created in Treasure Data."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/image-20190828-235909.ac60440369551b0d5812bc2ca30b343e77ceca43a3538ffcded425dfefc3c6b7.cf3845cb.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Select Save."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Navigate to Campaign. For example, select Marketo logo > Campaign."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Select Create New Web Campaign."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/image-20190828-235832.4e81bb76dc62523e0028099ffa009770454c2198700a0a93bda456574ad588f6.cf3845cb.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Select the segment name that you created in Treasure Data."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Set the contents. For example, Dialog, In Zone, and Widget."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/image-20190828-235754.08546d531bf44f2c90d77ea2575fca9128f01bcdaaa87ffb6c20842d602c2b89.cf3845cb.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"add-a-marketo-rtp-tag-and-treasure-data-tag","__idx":4},"children":["Add a Marketo RTP Tag and Treasure Data Tag"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Load Market’s Web Personalization JavaScript tag into your page. See e xamples below and refer to ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"http://developers.marketo.com/javascript-api/web-personalization/"},"children":["Marketo Documentation: Web Personalization"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Add a call to Treasure Data’s Profiles API."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Send the response to Marketo using the User Context feature of Marketo’s RTP tag.See examples below and refer to ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"http://developers.marketo.com/javascript-api/web-personalization/user-context/"},"children":["Marketo Documentation: User Context"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Test your code. For example:"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/image-20191209-220910.f90bb9f2d24e925667372b768bd654cdff3f98db46dc45fdbcd9160f0e2364be.cf3845cb.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"examples","__idx":5},"children":["Examples"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Example code for loading Market’s Web Personalization JavaScript tag into your page:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"//<!-- Marketo RTP tag -->\n(function(c,h,a,f,e,i){c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};\n\nc[a].p=e;c[a].a=i;var g=h.createElement(\"script\");g.async=true;g.type=\"text/javascript\";\n\ng.src=f;var b=h.getElementsByTagName(\"script\")[0];b.parentNode.insertBefore(g,b)})\n(window,document,\"rtp\",\"[rtp-js-cdn-url]\",\"[pod-url]\",\"[accountId]\");\nrtp('setAccount', 'YOUR_MARKETO_ACCOUNT_ID');  \n","lang":"javascript"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Example code for integrating TD profiles API with Marketo web personalization"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"html","header":{"controls":{"copy":{}}},"source":"<script type=\"text/javascript\">\n  //<!-- Marketo RTP -->\n(function(c,h,a,f,e,i){c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};\n\nc[a].p=e;c[a].a=i;var g=h.createElement(\"script\");g.async=true;g.type=\"text/javascript\";\n\ng.src=f;var b=h.getElementsByTagName(\"script\")[0];b.parentNode.insertBefore(g,b)})\n\n(window,document,\"rtp\",\"[rtp-js-cdn-url]\",\"[pod-url]\",\"[accountId]\");\n  rtp('setAccount', 'YOUR_MARKETO_ACCOUNT_ID');\n  \n// <!-- Treasure Data -->\n!function(t,e){if(void 0===e[t]){e[t]=function(){e[t].clients.push(this),this._init=[Array.prototype.slice.call(arguments)]},e[t].clients=[];for(var r=function(t){return function(){return this[\"_\"+t]=this[\"_\"+t]||[],this[\"_\"+t].push(Array.prototype.slice.call(arguments)),this}},s=[\"addRecord\",\"setblockEvents\",\"fetchServerCookie\",\"trackEventfetchGlobalID\",\"trackPageviewfetchUserSegments\",\"trackClicksresetUUID\",\"ready\",\"setSignedMode\",\"setAnonymousMode\",\"set\",\"trackEvent\",\"trackPageview\",\"fetchGlobalIDtrackClicks\",\"fetchUserSegmentsunblockEvents\"],an=0;a<sn<s.length;an++){var c=s[an];e[t].prototype[c]=r(c)}var no=document.createElement(\"script\");no.type=\"text/javascript\",no.async=!0,no.src=(\"https:\"===document.location.protocol?\"https:\":\"http:\")+\"//cdn.treasuredata.com/sdk/2.14/td.min.js\";var ia=document.getElementsByTagName(\"script\")[0];ia.parentNode.insertBefore(no,ia)}}(\"Treasure\",this);\n  \n  // Configure an instance for your database\n  var td = new Treasure({\n    host: 'in.treasuredata.com',\n    writeKey: '[YOUR_WRITE_KEY]',\n    database: '[YOUR_DB_NAME]'\n  });\n  \n  // Enable cross-domain tracking\n  td.set('$global', 'td_global_id', 'td_global_id');\n  \n  // Get segment number from TD and send it to Marketo's RTP\n    var successCallback = function(values) {  \n        var segIdAll = [];  \n        for (var i = 0; i < values.length; i++) {\n            segIdAll = segIdAll.concat(values[i].values);  \n        };  \n        var segId = segIdAll.filter(function (x,i,self) {\n            return self.indexOf(x) === i;\n        }); \n        // http://developers.marketo.com/javascript-api/web-personalization/user-context/  \n        rtp('set', 'customVar1', segId.join(\";\"));\n    };\n    var errorCallback = function(err) {\n      console.log(err);\n    };\n  \n  var trackPageviewSuccessCallback = function(){\n    td.fetchUserSegments({\n      audienceToken: ['YOUR_PROFILES_API_TOKEN_1', 'YOUR_PROFILES_API_TOKEN_2'],\n      keys: {\n        key_column_1: 'someValue',\n        key_column_2: 'someOtherValue',\n      }\n    }, successCallback, errorCallback)\n  };\n  \n  td.trackPageview([YOUR_TABLE_NAME], trackPageviewSuccessCallback);\n</script>   \n","lang":"html"},"children":[]}]},"headings":[{"value":"Integrate TD Profiles API with Marketo Web Personalization","id":"integrate-td-profiles-api-with-marketo-web-personalization","depth":1},{"value":"Prerequisites","id":"prerequisites","depth":1},{"value":"Integrating TD Profiles API with Marketo","id":"integrating-td-profiles-api-with-marketo","depth":1},{"value":"Configure Marketo for use with the TD Profile API","id":"configure-marketo-for-use-with-the-td-profile-api","depth":2},{"value":"Add a Marketo RTP Tag and Treasure Data Tag","id":"add-a-marketo-rtp-tag-and-treasure-data-tag","depth":2},{"value":"Examples","id":"examples","depth":1}],"frontmatter":{"seo":{"title":"Integrate TD Profiles API with Marketo Web Personalization"}},"lastModified":"2026-06-01T09:09:59.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/products/customer-data-platform/audience-studio/profiles/integrate-td-profiles-api-with-marketo-web-personalization","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}