ウェブサイトにタグを追加すると、測定サービスや広告サービス(Google アナリティクスや Google 広告コンバージョン測定など)でデータを収集できるようになります。タグを追加する際は、gtag.js という Google タグ(JavaScript コードの変更が必要)や、Google タグ マネージャーなどのタグ管理システム(タグ管理システム内の変更が必要)が使えます。
モバイルアプリに測定タグと広告タグをデプロイする場合は、Firebase 向け Google アナリティクス SDK が使えます。この SDK をデプロイすると、Google タグ マネージャーを使ってデータの変更とルーティングもできるようになります。
「タグ」とは
Google タグとは
Google タグ マネージャーとは
Google のドキュメントでは、Google タグ(直接記述)の使用例として gtag.js コードを、Google タグ マネージャーの使用例としてタグ設定の手順をご案内しています。
使用例
次の例は、Google タグ(直接記述)とタグ マネージャーの使用方法の違いを示したものです。
Google タグを直接記述する場合、ウェブサイトの各ページに追加するコードは次のようになります。コード内で指定されたタグ ID によって、Google アナリティクスと Google 広告での測定が可能になります。
<script async
src="https://www.googletagmanager.com/gtag/js?id=TAG_ID">
</script>
<script>
window.dataLayer = window.dataLayer || [] ;
function gtag(){dataLayer.push(arguments);}
gtag( 'js', new Date () ) ;
gtag( 'config', 'TAG_ID');
</script>
タグ マネージャーを使って Google アナリティクスと Google 広告での測定を可能にするには、Google アナリティクス用のタグと Google 広告のコンバージョン用のタグを作成し、どちらも同じトリガーで配信するように設定します。このコンテナを公開すると、その変更が直ちにウェブサイトに反映されます。詳しくは、Google 広告のコンバージョン トラッキングに関する記事をご覧ください。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2024-02-06 UTC。"],[[["Tagging involves adding code snippets to web pages to gather data on visitor behavior and site performance."],["The Google tag streamlines tag management, allowing connection to multiple Google products with a single code snippet."],["Implementing tags can be done through Google Tag Manager or gtag.js, offering varying levels of coding involvement."],["Website builders and content management systems often provide integrations for simplified tag setup."],["Mobile app tagging utilizes the Google Analytics for Firebase SDK and can be managed through Tag Manager."]]],["Tagging involves adding code snippets to website pages to track user behavior and gain insights for informed decision-making. The Google tag, a unified code snippet, can be implemented across a website and connected to multiple Google products. Implementation methods include Google Tag Manager, which requires two code snippets and allows tag management without coding, and gtag.js, requiring one code snippet and JavaScript proficiency. Website builders and the Firebase SDK offer integrations for simplified implementation.\n"]]