{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"redocly_category":"Products","product_name":"Audience Studio","type":"markdown"},"seo":{"title":"Use the 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":"use-the-profiles-api-with-marketo-web-personalization","__idx":0},"children":["Use the Profiles API With Marketo Web Personalization"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can integrate Treasure Data’s Profiles API Token with Marketo’s Web Personalization feature to provide a 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/use-the-profiles-api-with-marketo-web-personalization#h1_1644201065"},"children":["Prerequisites"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/audience-studio/profiles/use-the-profiles-api-with-marketo-web-personalization#h1__441927612"},"children":["Create the Profiles API Token"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/audience-studio/profiles/use-the-profiles-api-with-marketo-web-personalization#h2_251609309"},"children":["Name Your New Token"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/audience-studio/profiles/use-the-profiles-api-with-marketo-web-personalization#h2_196158072"},"children":["Configure the Token"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/audience-studio/profiles/use-the-profiles-api-with-marketo-web-personalization#h1__1028383756"},"children":["Add Segments to the Token"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/audience-studio/profiles/use-the-profiles-api-with-marketo-web-personalization#h1__182532925"},"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/use-the-profiles-api-with-marketo-web-personalization#h2_1294540003"},"children":["Configure Marketo for use with the Profiles API Token"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/audience-studio/profiles/use-the-profiles-api-with-marketo-web-personalization#h2_2234673"},"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/use-the-profiles-api-with-marketo-web-personalization#h1__1406500097"},"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":"Heading","attributes":{"level":1,"id":"create-the-profiles-api-token","__idx":2},"children":["Create the Profiles API Token"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"name-your-new-token","__idx":3},"children":["Name Your New Token"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Open Treasure Console."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Navigate to Audience Studio and select a segment."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Select a folder."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Select ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Create New"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Select ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Profile API Token"]},"."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/create_profile_api_token.d07368447c21f911e4cd104cea3710cce089327674fbd36df615c051711ff6c9.cf3845cb.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Enter a name for your token and optionally enter a description. Select Next."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"configure-the-token","__idx":4},"children":["Configure the Token"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The name and description carry over from when you named the token. You can make changes."]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Enter a ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Lookup Key"]},"."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A Lookup Key is a column with a unique value inside a parent segment. This key identifies the correct profile."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/note.767ca0ca6d076817a978148fbb7dd2a68ca7d067ced0ff61bfb3be582d0426d9.cf3845cb.png","alt":"Note"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Note:"]}," The lookup key update will take effect once the token workflow finishes."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When using ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["td_global_id"]}," as the lookup key, the Profiles API retrieves the lookup value from the browser cookie instead of the API request's query param. For testing or verification purposes outside of a browser (eg, Postman), use a different column to pass in the lookup value manually."]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["(Optional) Enter a maximum of five attributes."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Profile attributes can be returned from the profile token when queried."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/cptoken_lookupkey.a4fdda5f033ac9bc65803145af0187498c5a29fec6d8dae8ceb8fb94771598ff.cf3845cb.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Choose one of the following:"]}]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Select ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Next"]}," to continue and add Segments."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Select ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Create"]}," to configure the token. (You can add segments later if you want.)"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/config_token.0d19c72c2bfbc57a48198756674abe5a80f6f4782cc23b744568f79f354be71d.cf3845cb.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"add-segments-to-the-token","__idx":5},"children":["Add Segments to the Token"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Choose one of the following:"]}]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["After you configure your token, select Next."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Navigate to Audience Studio > Folder > Profiles API Token."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/segmentselect.125e8e424498ad8117a756c58875a8ee9d5d7999c778df16ae54e4307c739a18.cf3845cb.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Add segments to your Profiles API Token."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Select ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Save"]},".",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/use-the-profiles-api-with-facebook-custom-audience-2024-02-08.6d199d43e89e4355f3218d3b5e63a8105d8656d109565e985d922b15621a62e8.cf3845cb.png","alt":""},"children":[]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"integrating-td-profiles-api-with-marketo","__idx":6},"children":["Integrating TD Profiles API with Marketo"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Complete the steps in the following sections to integrate the Profiles API Token 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-profiles-api-token","__idx":7},"children":["Configure Marketo for use with the Profiles API Token"]},{"$$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":8},"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 examples 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 the Profiles API Token."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Send the response to Marketo using the User Context feature of Marketo’s RTP tag."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["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":9},"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)};\nc[a].p=e;c[a].a=i;var g=h.createElement(\"script\");g.async=true;g.type=\"text/javascript\";\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 the Profiles API Token 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  c[a].p=e;c[a].a=i;var g=h.createElement(\"script\");g.async=true;g.type=\"text/javascript\";\n  g.src=f;var b=h.getElementsByTagName(\"script\")[0];b.parentNode.insertBefore(g,b)})\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\",\"blockEvents\",\"fetchServerCookie\",\"fetchGlobalID\",\"fetchUserSegments\",\"resetUUID\",\"ready\",\"setSignedMode\",\"setAnonymousMode\",\"set\",\"trackEvent\",\"trackPageview\",\"trackClicks\",\"unblockEvents\"],n=0;n<s.length;n++){var c=s[n];e[t].prototype[c]=r(c)}var o=document.createElement(\"script\");o.type=\"text/javascript\",o.async=!0,o.src=(\"https:\"===document.location.protocol?\"https:\":\"http:\")+\"//cdn.treasuredata.com/sdk/2.14/td.min.js\";var a=document.getElementsByTagName(\"script\")[0];a.parentNode.insertBefore(o,a)}}(\"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":"Use the Profiles API With Marketo Web Personalization","id":"use-the-profiles-api-with-marketo-web-personalization","depth":1},{"value":"Prerequisites","id":"prerequisites","depth":1},{"value":"Create the Profiles API Token","id":"create-the-profiles-api-token","depth":1},{"value":"Name Your New Token","id":"name-your-new-token","depth":2},{"value":"Configure the Token","id":"configure-the-token","depth":2},{"value":"Add Segments to the Token","id":"add-segments-to-the-token","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 Profiles API Token","id":"configure-marketo-for-use-with-the-profiles-api-token","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":"Use the Profiles API With Marketo Web Personalization"}},"lastModified":"2026-06-01T09:09:59.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/products/customer-data-platform/audience-studio/profiles/use-the-profiles-api-with-marketo-web-personalization","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}