{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-@l10n/ja/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Osano Cookie Consentを使用したJavaScriptでのWeb Tracking","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":"osano-cookie-consentを使用したjavascriptでのweb-tracking","__idx":0},"children":["Osano Cookie Consentを使用したJavaScriptでのWeb Tracking"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["ウェブサイトはcookieを使用してコンテンツと広告をパーソナライズし、ソーシャルメディア機能を強化し、サイトのトラフィックを監視します。Cookieにより、ウェブサイトはサイトの使用方法に関する情報をソーシャルメディア、広告、分析パートナーと共有できます。"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["ウェブサイトは、GDPRやCCPAなどのプライバシーおよびセキュリティ法に準拠するために、お客様の情報を使用する許可またはcookie consentを取得する必要があります。"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Cookie Consentを使用すると、ウェブサイトでcookieを使用していることをユーザーに警告できます。Osanoは無料のJavaScript pluginを提供しています。"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#about-osano"},"children":["Osanoについて"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#prerequisites"},"children":["前提条件"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#testing-the-free-version-of-osano"},"children":["Osanoの無料版のテスト"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#sample-view"},"children":["サンプルビュー"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"osanoについて","__idx":1},"children":["Osanoについて"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Osanoは、顧客データを共有するすべてのvendorを管理するデータプライバシープラットフォームです。数分と1行のJavaScriptで、Osanoはウェブサイトがcomply GDPRやCCPAなどの法律に準拠するのに役立ちます。"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["幅広いレイアウトとカラースキームから選択できます。"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/image-20200611-141051.1f598e651444ee85b47976d2d720e0719693478d723347268765f094c61d5956.ad50cbca.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"前提条件","__idx":2},"children":["前提条件"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://www.osano.com/cookieconsent/download/"},"children":["Osano wizardとconfiguratorをダウンロード"]},"します。または、",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://www.osano.com/cookieconsent/documentation/javascript-api/"},"children":["JavaScript API documentation"]},"を使用できます。"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"osanoの無料版のテスト","__idx":3},"children":["Osanoの無料版のテスト"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["テスト用のサンプルランディングページHTMLファイルを定義します。"," ","たとえば、以下のtest.mdコードを使用できます。"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["サンプルコードの以下のfieldを置き換えます:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<TD_write_only_API_key>"]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<write_your_db_name>"]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<write_your_table_name>"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"html","header":{"controls":{"copy":{}}},"source":"<html>\n  <head>\n    <script>\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.5/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: '<TD_write_only_API_key>',\n      database: '<write_your_db_name>',\n\n      startInSignedMode: true\n    });\n\n    // Enable cross-domain tracking\n    td.set('$global', 'td_global_id', 'td_global_id');\n\n    // Track pageview information to a table\n    td.trackPageview('<write_your_table_name>');\n    </script>\n\n    <!-- =======================================================\n    Start https://cookieconsent.insites.com/ tag\n    ======================================================= -->\n    <link rel=\"stylesheet\" type=\"text/css\" href=\"https://cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.1.0/cookieconsent.min.css\" />\n    <script src=\"https://cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.1.0/cookieconsent.min.js\"></script>\n    <script>\n      window.addEventListener(\"load\", function(){\n        window.cookieconsent.initialise({\n          \"palette\": {\n          \"popup\": {\n          \"background\": \"#3c404d\",\n          \"text\": \"#d6d6d6\"\n          },\n          \"button\": {\n          \"background\": \"#8bed4f\"\n          }\n        },\n          \"type\": \"opt-out\",\n          \"revokable\": true,\n          onStatusChange: function(status) {\n            this.hasConsented() ? td.setSignedMode() : td.setAnonymousMode();\n          },\n        })\n      });\n    </script>\n    </head>\n  </body>\n</html>\n","lang":"html"},"children":[]},{"$$mdtype":"Tag","name":"ol","attributes":{"start":3},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["簡単なHTTPサーバーをセットアップします:"," ","たとえばMacの場合:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"sudo apachectl start\nsudo cp test.md /Library/WebServer/Documents\n# setup owner and permission same with other files in copy destination folder above\n# sudo chown\n# sudo chmod\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["以下のURLを使用してbrowserからアクセスしてみてください: ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"http://127.0.0.1/test.md"},"children":["http://127.0.0.1/test.md"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["または、このライブデモを参照できます: ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://treasure-data.github.io/js-examples/consensus-management/index.html"},"children":["https://treasure-data.github.io/js-examples/consensus-management/index.html"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["下部にバーが表示された空白のページが表示されます。Allow cookiesを選択しないでください。"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/screen_shot_2019-03-13_at_18.28.45.ed34df1f38e7b557e489b90bfbf7161a4e292df6e91cd2845493a3bfa8832eb6.ad50cbca.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"ol","attributes":{"start":4},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["ページを数回更新し、tracking情報が送信される宛先tableを確認します。"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["最大で数分後には、宛先tableでstreamingデータが表示され始めるはずです。SELECT TABLE statementを実行して確認できます。"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sql","header":{"controls":{"copy":{}}},"source":"select td_ip,td_client_id,td_global_id from <db name>.<tbl name>\n","lang":"sql"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/screen_shot_2019-03-13_at_18.18.35.050e9f4360943cc3501eea0b94af96ca31e47f6bdbedfb4a98442b5a57d3245d.ad50cbca.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"ol","attributes":{"start":5},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["test.mdページでDeclineを選択します。"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["ページを更新します。"," ","更新後、consent promptは表示されなくなります。"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/screen_shot_2019-03-13_at_18.28.45.ed34df1f38e7b557e489b90bfbf7161a4e292df6e91cd2845493a3bfa8832eb6.ad50cbca.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"ol","attributes":{"start":7},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["web trackingの宛先tableを再度確認します。"," ","最大で数分後には、宛先tableで新しいstreamingデータが表示され始めるはずです。SELECT TABLE statementを実行して確認できます。"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sql","header":{"controls":{"copy":{}}},"source":"select td_ip,td_client_id,td_global_id from <db name>.<tbl name>\n","lang":"sql"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["ご覧のとおり、td_ip、td_client_id、td_global_id columnがTDに送信されたstreamingデータから除外されています。"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/screen_shot_2019-03-13_at_18.21.49.95acf0d08ec7aa9dc7bf145888f3f1096245066fbd356463fb64f9aea013aca7.ad50cbca.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"ol","attributes":{"start":8},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["テストをクリーンアップするには、ローカルPCで実行されているHTTPサーバーを停止します。"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"sudo apachectl stop\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"ol","attributes":{"start":9},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["test.mdファイルを削除します。"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"sudo rm -f Library/WebServer/Documents/test.md\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"サンプルビュー","__idx":4},"children":["サンプルビュー"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["ユーザーが初めてwebページにアクセスすると、デフォルトで以下の情報が保存されたcookieに含まれます(td_ip、td_client_id、td_global_id):"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/image-20200619-193149.9c800ea1d15773b0e5d82f2b2e64402aa3a0ae7cd0b5a047cdcd6fd292469f6a.ad50cbca.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["ユーザーがcookie consent promptで",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Decline"]},"を選択した場合、以下のfield(td_ip、td_client_id、td_global_id)は、このユーザーによる後続のページ訪問では送信されません:"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/image-20200619-194719.dfa5a50849ce716bd83856dac95ebdc21c33e04d1a1a5db04a38f84962af8512.ad50cbca.png","alt":""},"children":[]}]}]},"headings":[{"value":"Osano Cookie Consentを使用したJavaScriptでのWeb Tracking","id":"osano-cookie-consentを使用したjavascriptでのweb-tracking","depth":1},{"value":"Osanoについて","id":"osanoについて","depth":2},{"value":"前提条件","id":"前提条件","depth":2},{"value":"Osanoの無料版のテスト","id":"osanoの無料版のテスト","depth":2},{"value":"サンプルビュー","id":"サンプルビュー","depth":2}],"frontmatter":{"seo":{"title":"Osano Cookie Consentを使用したJavaScriptでのWeb Tracking"}},"lastModified":"2026-05-14T07:31:32.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/ja/products/customer-data-platform/integration-hub/streaming/td-javascript-sdk/web-tracking-with-javascript-using-osano-cookie-consent","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}