Hi team,
I’m working on setting up Google Ads (not Google AdSense) on my XenForo forum (www.gtwerks.com). I’ve attempted to add the following code by navigating to Appearance > Templates > Page_Container and placing it between the </head>; tags, but it doesn’t seem to be working:
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-xxxxxxxxxxx">
</script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'AW-1xxxxxxxxxx');
</script>
I recently spoke with the Google Ads technical support team, and they suggested replacing my previous code with the following updated code. They advised placing it in Appearance > Templates > Page_Container within the </head>; and </body>; tags and it doesn't appear to be working:
NOTE: this was generated using the Google Tag Manager per Google's recommendation
1. Paste this code as high in the <head> of the page as possible:
<!-- 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-xxxxxxxxx');</script>
<!-- End Google Tag Manager -->
2. Paste this code immediately after the opening <body> tag:
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-xxxxxx"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
It appears that some members do have Google Ads (NOT Google Adsense) working. The XenForo tech team says that the code is working and therefore a Google problem and Google says it's a XenForo problem....It's actually a me problem LOL.
Any help would be greatly appreciated. Happy 2025 and I hope this helps other users!
I’m working on setting up Google Ads (not Google AdSense) on my XenForo forum (www.gtwerks.com). I’ve attempted to add the following code by navigating to Appearance > Templates > Page_Container and placing it between the </head>; tags, but it doesn’t seem to be working:
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-xxxxxxxxxxx">
</script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'AW-1xxxxxxxxxx');
</script>
I recently spoke with the Google Ads technical support team, and they suggested replacing my previous code with the following updated code. They advised placing it in Appearance > Templates > Page_Container within the </head>; and </body>; tags and it doesn't appear to be working:
NOTE: this was generated using the Google Tag Manager per Google's recommendation
1. Paste this code as high in the <head> of the page as possible:
<!-- 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-xxxxxxxxx');</script>
<!-- End Google Tag Manager -->
2. Paste this code immediately after the opening <body> tag:
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-xxxxxx"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
It appears that some members do have Google Ads (NOT Google Adsense) working. The XenForo tech team says that the code is working and therefore a Google problem and Google says it's a XenForo problem....It's actually a me problem LOL.
Any help would be greatly appreciated. Happy 2025 and I hope this helps other users!
Last edited: