{"repo":"tfmurad/astro-gtm-lite","free":true,"listed":false,"github":"https://github.com/tfmurad/astro-gtm-lite","clone":"git clone https://github.com/tfmurad/astro-gtm-lite.git","description":"Astro v6 with ViewTransition GTM integration. Lightweight Google Tag Manager, zero-config.","language":"TypeScript","stars":14,"topics":["analytics","astro-component","astro-integration","google-tag-manager","gtm","tracking","withastro"],"license":"MIT","category":"analytics","readme_excerpt":"astro-gtm-lite A zero-component Astro integration for Google Tag Manager (GTM) . Easily inject Google Tag Manager snippets into your Astro site. Supports Astro v5,v6 and v7. Works seamlessly with View Transitions (clientRouter) . Instead of manually adding GTM and tags to every page, astro-gtm-lite hooks into Astro's build pipeline and injects the official Google Tag Manager snippets automatically — no layout edits required. --- Install Usage — Integration (recommended) Add it once in astro.config.mjs and forget about it: The script is injected automatically into every page — no layout edits required. Note: GTM is disabled during astro dev by default. Set devMode: true if you want to test GTM in development. Astro View Transitions astro-gtm-lite works seamlessly with and without Astro View Transitions. On each client-side navigation, a virtualPageview event is pushed to dataLayer with the updated page path and title. The astro:after-swap event is used, which fires immediately after the DOM is swapped — perfect for analytics tracking. To track these virtual page views in GTM, create a Custom Event trigger with event name virtualPageview , and use Data Layer Variables for virtualPagePath and virtualPageTitle to populate your GA4 / Universal Analytics tags. Options Option Type Default Description --------------- --------- ------------------------------------ -------------------------------------- id string required Your GTM container ID ( GTM-XXXXXX ) enable boolean true Globall","default_branch":null,"files":null,"tree":[],"storefront":"/r/tfmurad","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/tfmurad/astro-gtm-lite/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}