{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-@l10n/ja/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Google Tag Manager Import Integration","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":"google-tag-manager-import-integration","__idx":0},"children":["Google Tag Manager Import Integration"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Treasure Dataは",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"http://www.google.com/tagmanager/"},"children":["Google Tag Manager"]}," (GTM) と連携して、データを一箇所に収集します。この統合により、Googleの管理ツールがお客様のニーズに合わせてより強力になります。"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"前提条件","__idx":1},"children":["前提条件"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["JavaScript / HTMLの基本知識"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Treasure Dataの基本知識"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"タグの作成","__idx":2},"children":["タグの作成"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["コンテナを作成したら、その中にCustom HTML Tagとして新しいタグを作成できます。タグとは、他のプラットフォームにデータを送信するように設定されたコードです。タグは、ウェブサイトのソースコードを編集することなく、さまざまなサードパーティツールを組み合わせるために使用されます。"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Google Tag Managerを開きます。"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["コンテナを選択します。"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Configure Tagセクションに以下の行を追加し、",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://docs.treasuredata.com/smart/project-product-documentation/getting-your-api-keys"},"children":["write-only APIキー"]},"とデータベース名を設定します。以下のタグは",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["All Pages"]},"トリガーに関連付けて実行する必要があります。"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"html","header":{"controls":{"copy":{}}},"source":"<!-- Treasure Data -->\n<script type=\"text/javascript\">\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: 'YOUR_WRITE_ONLY_APIKEY_IS_HERE',\n    database: 'DATABASE_NAME'\n  });\n  // Enable cross-domain tracking\n  td.set('$global', 'td_global_id', 'td_global_id');\n  // track pageview information to 'pageviews' table\n  td.trackPageview('pageviews');\n</script>\n","lang":"html"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["画面は次のようになります。"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/image-20200422-201738.55c22279978010c4c154b63e6c7fa009b5d1b88799aa22dc36ac31fadb19eadc.07b9aa4f.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"click-url変数のトラッキング","__idx":3},"children":["Click URL変数のトラッキング"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Click Triggerを設定することで、ユーザーがクリックしたリンクを追跡できます。これにより、データと{{Click URL}}変数を含む追加のJavaScriptタグがTreasure Dataに送信されます。{{Click URL}}変数には、リンクのURL情報が含まれています。Click Triggerを使用して、ページビューを追跡できない外部サイトへのリンクをユーザーがクリックしたときを追跡できます。Google Tag Managerの変数により、トラッキングがより適応性の高いものになります。変数は変化する値を保持するコンテナのようなもので、ウェブサイトのコンテキストから情報を取得してタグに渡すことができるため、トラッキングと分析の設定がよりカスタマイズ可能になります。"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"click-url変数の有効化","__idx":4},"children":["{{Click URL}}変数の有効化"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["ワークスペースから、",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Variables"]},"を選択します。"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Configure"]},"を選択します。"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["変数パネルのClicksセクションで、",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Click URL"]},"を選択します。"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/image2020-11-24_9-35-55.888c0c3de33389a39907dbf47e3e2df2cc2f9c5f4e32ac19b1bdcbc36c348275.07b9aa4f.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"click-triggerの定義","__idx":5},"children":["Click Triggerの定義"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["タグはトリガーに関連付けられます。トリガーとは、ウェブサイト上でタグを実行するタイミングと場所を決定するルールまたは条件です。トリガーはイベントリスナーとして機能し、ウェブサイトのアクティビティを監視します。トリガーは、関連付けられたタグに実行するよう信号を送ります。トリガーは、タグがいつ、どこでアクティブ化または実行されるかを制御します。"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["ワークスペースから、",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Triggers"]},"を選択します。"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["New"]},"を選択します。"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Trigger Configuration Panelで、",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Click - Just Links"]},"を選択します。References to this Triggerの下にClicksタグが選択され、トリガーへの参照が実行されるようになります。"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/image2020-11-24_9-36-33.daaf806bd9bc015780820075b1a6ac90067b34f18ed2d072ffc65befe0463087.07b9aa4f.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"click-triggerのタグ設定","__idx":6},"children":["Click Triggerのタグ設定"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["References to this Triggerパネルで、",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Clicks"]},"を選択します。"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Tag Typeの下で",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Custom HTML"]},"を選択します。"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/image2020-11-24_9-37-32.d355c1a6af51aa04239d4d77e8de2106a578c7036ce72fe5b8381c9965eed588.07b9aa4f.png","alt":""},"children":[]}," ","3. HTMLセクションに、以下のコードを挿入します。"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"html","header":{"controls":{"copy":{}}},"source":"<script type=\"text/javascript\">\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.4/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_ONLY_APIKEY_IS_HERE',\n  database: 'DATABASE_NAME'\n  });\n  // Enable cross-domain tracking\n  td.set('$global', 'td_global_id', 'td_global_id');\n\n  // Track click information to 'clickviews' table\n  var click_url = {{Click URL}};\n  td.set('clickviews', {click_url: click_url});\n  td.trackPageview('clickviews');\n</script>\n","lang":"html"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["これにより、pageviewsテーブルに追加のclick_urlカラムが表示されます。"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/image2020-11-24_9-38-13.18d82df6cde67c51bf348d1ad25811a115b8f1b63cf6f7dfb326f20dc3c5f8a4.07b9aa4f.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"em","attributes":{},"children":["All Pages"]},"と",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["click_trigger"]},"の2つのTDタグが登録されているはずです。"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/image2020-11-24_9-39-9.e92ab18fa7261822b88913ec1e1fbe3169b3d94e8ab7908593904bd5ffb7693d.07b9aa4f.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"google-tag-managerからのデータの除外","__idx":7},"children":["Google Tag Managerからのデータの除外"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Google Tag Managerに関連するレコードが表示される場合があります。これらのレコードに含まれるデータの例については、以下の表を参照してください。"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"td_title"},"children":["td_title"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"td_referer"},"children":["td_referer"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"td_host"},"children":["td_host"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"td_url"},"children":["td_url"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["gtm-msr"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://gtm-msr.appspot.com/render?id=xxxxxxx"},"children":["https://gtm-msr.appspot.com/render?id=xxxxxxx"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"http://gtm-msr.appspot.com/"},"children":["gtm-msr.appspot.com"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://gtm-msr.appspot.com/render2?id=xxxxx"},"children":["https://gtm-msr.appspot.com/render2?id=xxxxx"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["クエリ結果からデータを除外するには、次のいずれかを選択します:"]}]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["td_titleまたはtd_hostを使用して結果をフィルタリングする。"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["テーブルにデータを記録したくない場合は、コードに以下を追加します:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"html","header":{"controls":{"copy":{}}},"source":"<script type=\"text/javascript\">\n  if (document.location.href.search('gtm-msr.appspot') == -1) {\n /* Attribution code here */\n  }\n</script>\n","lang":"html"},"children":[]}]},"headings":[{"value":"Google Tag Manager Import Integration","id":"google-tag-manager-import-integration","depth":1},{"value":"前提条件","id":"前提条件","depth":2},{"value":"タグの作成","id":"タグの作成","depth":2},{"value":"Click URL変数のトラッキング","id":"click-url変数のトラッキング","depth":2},{"value":"{{Click URL}}変数の有効化","id":"click-url変数の有効化","depth":3},{"value":"Click Triggerの定義","id":"click-triggerの定義","depth":3},{"value":"Click Triggerのタグ設定","id":"click-triggerのタグ設定","depth":3},{"value":"Google Tag Managerからのデータの除外","id":"google-tag-managerからのデータの除外","depth":1}],"frontmatter":{"seo":{"title":"Google Tag Manager Import Integration"}},"lastModified":"2025-11-12T07:49:46.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/ja/int/google-tag-manager-import-integration","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}