google-ads.tsx

src/hooks/google-ads.tsx
import Script from 'next/script'
type GoogleAdsProps = {
adId: string
loadGtagJs?: boolean // Optional flag to skip duplicate gtag.js load
}
export default function GoogleAds({ adId, loadGtagJs = true }: GoogleAdsProps) {
if (!adId) return null
return (
<>
{loadGtagJs && (
<Script
src={`https://www.googletagmanager.com/gtag/js?id=${adId}`}
strategy="afterInteractive"
/>
)}
<Script
id="google-ads-config"

Showing the first 20 lines.

Get full code

Support

Talk to the developers of this project to learn more

We have been building professional websites for big clients for over 15 years. Gallop templates and blocks is our best foundation for SEO websites and web apps.

© 2026 Web Plant Media, LLC