From b0b813e3d704bdb6b7dc8cec17c0221723a5f7fb Mon Sep 17 00:00:00 2001 From: Kresna <13603341+slaveofcode@users.noreply.github.com> Date: Tue, 11 Aug 2026 13:11:22 +0700 Subject: [PATCH] feat(analytics): add Google Ads page-view conversion event Fires the AW-18373579775/4BVPCOXG99wcEP-nmrlE page-view conversion on first load and on every Astro SPA navigation (astro:page-load), inside the production-hostname guard so only goodwebtools.com reports it. --- src/layouts/Base.astro | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/layouts/Base.astro b/src/layouts/Base.astro index 7e38389..298c8b0 100644 --- a/src/layouts/Base.astro +++ b/src/layouts/Base.astro @@ -169,6 +169,12 @@ const jsonLdBlocks = [siteJsonLd, ...(Array.isArray(jsonLd) ? jsonLd : jsonLd ? window.gtag = window.gtag || function () { window.dataLayer.push(arguments); }; window.gtag('js', new Date()); window.gtag('config', 'AW-18373579775'); + // Page-view conversion — fire on first load and on every SPA navigation. + function fireConversion() { + window.gtag('event', 'conversion', { send_to: 'AW-18373579775/4BVPCOXG99wcEP-nmrlE' }); + } + fireConversion(); + document.addEventListener('astro:page-load', fireConversion); })(); }