Google Analyticsの新計測タグ「gtag.js」

新計測タグ「Global Site Tag」のお話。

ふと新規案件でサイト制作をして、いつものようにGoogle Analyticsタグを入れようと思ったら、タグが変わったかなと・・・
とはいえ、いつものように貼り付けて確認したところ、問題なく動く。

気のせいかな。

で、イベントトラッキングが必要なので、いつものように、

ga('send', 'event', xxxxxxxxx)

としたところ、上がってこない・・・

「gtag.js」?

あ、Global Site Tagに切り替わったのか。
使い方はほとんど変わらずだけど、

gtag('event', 'action', {})

と書く。

Track Google Analytics Events | Analytics for Web (gtag.js) | Google Developers

The following table lists the default Google Analytics Events, their default categories, and default label types (if available). For event names not listed in this table (e.g. arbitrary event names that you create), the default category is ‘engagement’ and the default label is ‘not set’.

既存のタグはいつまで有効なんだろう。