My Google Analytics code is:
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-119899800-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-119899800-1');
</script>
Google AdWords gives me the same code like:
<!-- Global site tag (gtag.js) - Google AdWords: 796207283 -->
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-796207283"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'AW-796207283');
</script>
Where & how to locate those code together?
They are totally two different things that serve two very different purposes. Google Tag Manager lets you manage various Javascript tracking codes (also known as Tags) on your website. Google Analytics tracking code is one of those tags.
Unlike analytics. js, gtag. js doesn't use trackers to send data to Google Analytics. It sends data to Google Analytics properties identified by their IDs set by the config command.
By dual tagging you can keep your Universal Analytics implementation in place while you build out your Google Analytics 4 implementation.
You should merge codes in this way:
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-119899800-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-119899800-1');
gtag('config', 'AW-796207283');
</script>
and insert it in <head>
of pages you need.
https://support.google.com/google-ads/answer/7548399?hl=en
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With