GA4

Google Tag Managerは、次のような場合に有効です。

  • 独自イベントやコンバージョンの計測を行う場合
  • リリース前にプレビューとデバッグモードでテストを行う場合
  • 他のサードパーティーツール(Facebook pixel、LinkedIn Insightなど)を開発者なしで導入・管理したい場合

グローバルサイトタグ(gtag.js)は、次のような場合に有効です。

  • ウェブページに直接タグを設置したい場合
  • ウェブサイトで追跡されるタグを完全に制御したい場合
  • 他のサードパーティーツールと連携させたくない場合

グローバルサイトタグとGoogle Tag Managerの違いについて|Implement Digital 2022

Googleタグを理解するためのメモ|ysnr_ksm 2024

Debugview

Debugviewは設定したイベントが収集ができているかを確認できる機能です。
Googleアナリティクス4[概論編]初心者必見!どこよりも詳しく解説!Debugviewってどうやって使うの?

Global site tag(gtag.js) と Google Tag Manager(gtm.js) 同時利用

gtag('event', ...) が発火しない?

https://support.google.com/analytics/thread/183617792/gtag-events-not-sending-to-ga4-when-loaded-through-gtm?hl=en

As Tony indicated, you really don't want to mix gtag calls sources on the same pages. Either go with GTM or gtag.js. And the best practice is to go with GTM to keep all your analytics logic in one place, so really the proper solution is exactly what you're avoiding. Your gtag() implementation is just a tech debt at this point, really.

If you want to keep your analytics in two places then what you want to do is first make sure GTM has no ga4 tags active, then go and debug your gtag calls in the console/network tab to see what's happening. As well as the loading of your gtag.js library.

https://stackoverflow.com/questions/76272546/my-custom-ga4-events-stopped-sending-after-i-added-gtm-to-my-website

Once you create the GA4 Configuration Tag via GTM, your site will include gtag.js from GTM.

https://stackoverflow.com/questions/72614446/gtag-js-and-gtm

gtag.js(Googleアナリティクス)とGTM(Googleタグマネージャー)を同時に使う場合は、どうすれば良いのでしょうか?
GTMのページビュータグを停止すればOKです。
gtag.js(Googleアナリティクス)とGTMを同時に使う方法 - たなかまjp 2023

https://stackoverflow.com/questions/77458772/google-tag-manager-gtag-events-custom-not-working-send-request-on-wordpress

gtag.js タグ ID 複数
<head>
 ...
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXX"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments)};
  gtag('js', new Date());
  gtag('config', 'GT-XXXXXX');
  gtag('config', 'DC-ZZZZZZ');
</script>
</head>

...
event コマンドを使用すると、config で指定したサービスにイベントデータを送信できます。コマンドは次のような形式になります。

https://developers.google.com/tag-platform/gtagjs/configure?hl=ja

gtag.js を使わない場合

1 つの Google Tag Manager と複数環境の GA4 を接続する 2023