update google analytics tag.

This commit is contained in:
Yoshihiro OKUMURA 2024-09-19 13:41:06 +09:00
parent 2152e4d435
commit 2b311fb88a

View File

@ -31,14 +31,15 @@ add_action('wp_head', 'niu_add_google_analytics');
function niu_add_google_analytics()
{
echo <<<EOF
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-7G7QBM2Z3Y"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-K6BD5N9');</script>
<!-- End Google Tag Manager -->
gtag('config', 'G-7G7QBM2Z3Y');
</script>
EOF;
}