In the docs for third parties it shows examples of using a tag with GTM-xxxx, but with Google Ads it wants me to use a tag with AW-xxxx.
Does the GoogleTagManager component support this? I’ve tested it out and it says I have a tag on the site, but it doesn’t want to track conversions on page load with it. Here is how I’m using it in my RootLayout -
import { GoogleTagManager } from '@next/third-parties/google'
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<>
<GoogleTagManager gtmId="AW-xxxxxxxx" />
<main className="flex-1">{children}</main>
</>
)
}
Because it’s not a custom event, like a button click, I can just use a generic gtag script. This is the snippet Google wants me to install -
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-xxxxxxxx"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'AW-xxxxxxxx);
</script>
The event I’m trying to track is a pageload of a specific url.