{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-@l10n/ja/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"TD JavaScript SDKを使用してプロファイルセグメントIDを取得する","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":"td-javascript-sdkを使用してプロファイルセグメントidを取得する","__idx":0},"children":["TD JavaScript SDKを使用してプロファイルセグメントIDを取得する"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["セグメントIDをツールに適用して、プロファイルに高度にパーソナライズされたコミュニケーションをプッシュしたり、指定されたセグメント内のプロファイルに表示される内容を制御したりできます。通常、これには当社のサポートまたはサービスチームとの連携が必要です。"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["以下を含めることで、Treasure Data SDKスクリプトをクライアントに追加します:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["APIリクエスト"]}]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["audienceToken: Profiles APIトークンのリスト"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["keys: キーカラムのリスト"]}]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["APIレスポンス"]}]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["values: 値、属性、キー、およびaudienceIdのオブジェクト"]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["ツール(OptimizelyやGoogle Chrome Developer Toolsなど)がクライアントにアクセスしてセグメントIDを取得します。"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["作成したトークンをコピーして、以下のようにJS SDKスクリプトに追加します。"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"html","header":{"controls":{"copy":{}}},"source":"<!-- Treasure Data -->\n<script type=\"text/javascript\"> !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/3.1/td.min.js\";var a=document.getElementsByTagName(\"script\")[0];a.parentNode.insertBefore(o,a)}}(\"Treasure\",this);\n</script>\n<script>\n  var td = new Treasure({...})\n\n  var successCallback = function (values) {\n    /* values format => [... {\n      key: {\n        [key]:value\n      },\n      values: [\"1234\"],\n      attributes: {\n        age: 30\n      },\n\n    } ... ]*/\n    // celebrate();\n  };\n\n  var errorCallback = function (error) {\n    // cry();\n  };\n\n  td.fetchUserSegments({\n    audienceToken: ['YOUR_PROFILES_API_TOKEN_1', 'YOUR_PROFILES_API_TOKEN_2'],\n    keys: {\n      someKey: 'someValue',\n      someOtherKey: 'someOtherValue',\n    }\n  }, successCallback, errorCallback)\n</script>\n","lang":"html"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"プロファイル出力の例","__idx":1},"children":["プロファイル出力の例"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["以下は、Google Chrome Developer Toolsを使用した出力例です。"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/image2021-10-7_12-19-11.608b3a3670317c7c651b93c6431013570fdde76563605ef0d39184a440fe1266.cf3845cb.png","alt":""},"children":[]}]}]},"headings":[{"value":"TD JavaScript SDKを使用してプロファイルセグメントIDを取得する","id":"td-javascript-sdkを使用してプロファイルセグメントidを取得する","depth":1},{"value":"プロファイル出力の例","id":"プロファイル出力の例","depth":2}],"frontmatter":{"seo":{"title":"TD JavaScript SDKを使用してプロファイルセグメントIDを取得する"}},"lastModified":"2025-11-22T02:43:27.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/ja/products/customer-data-platform/audience-studio/profiles/use-td-javascript-sdk-to-fetch-profile-segment-ids","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}