How to add 2 different Google Tag IDs into HTML of website?

596 views Asked by At

I'm new to Google Ads and Google Tag Manager. I need to add 2 different Google Tag IDs to the same website. They're from the same Google Tag Manager account. They have the same Container ID. One tag is for Google Analytics tracking, and the other is for our Google Ads tracking and conversion.

How do I add both of these tags in the HTML? Here is the code (I've removed reference to the specific tag IDs in the HTML for security / privacy reasons):

<script async src="https://www.googletagmanager.com/gtag/js?id=G-(Google Analytics tag goes here)"></script> 
<script>   window.dataLayer = window.dataLayer || [];   function gtag(){dataLayer.push(arguments);}   gtag('js', new Date());   gtag('config', 'G-(Google Analytics Tag goes here)'); 
</script>
window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'AW-(Google Ads tag goes here)');

I've added both of these next to each other in the HTML, but I haven't published them on the live website in case I mess up the company's reporting on Google Analytics.

Any help would be really appreciated!

Thanks!

1

There are 1 answers

0
A_Patterson On

If you are leveraging GTM to launch tags, then all you will need to do is place a Google Tag associated with the Ads account. This can be done within GTM and will not impact any Google Analytics tag on the website.

I would advise not hard coding the script into the HTML since you have a tag management system in place. Let GTM do the heavy lifting and handling launching both the GA and the Ads tags.

If you don't want to go that route for whatever reason, @easlyfixed comment is correct. You can place the two separate scripts (one for GA, one for Ads) on the page and they will not impact each other.