Overview
The Astro Google Tag Manager integration provides a smooth solution for adding Google Tag Manager (GTM) snippets into your Astro projects. This tool supports various web analytics tools, enhancing your website’s tracking capabilities. With a straightforward installation process and accessible components, it simplifies the implementation of GTM for developers and businesses looking to optimize their data collection strategies.
The package includes essential features that allow for flexible customization, enabling users to inject GTM scripts, set up site verification, and leverage advanced capabilities like Partytown for improved performance. Whether you’re managing a personal website or a larger web application, this integration helps you ensure that your tracking is both efficient and compliant with data regulations.
Features
GoogleTagmanager Component: Easily injects the Google Tag Manager script into your project by passing your GTM measurement ID. Optionally, specify a custom domain and container path for added flexibility.
GoogleTagmanagerNoscript Component: Provides a reliable no-script fallback for GTM, which should be placed immediately after the opening
<body>tag.GoogleTagmanagerPartytown Component: Enhances performance by offloading GTM script execution to a web worker. This component also requires the GTM measurement ID for setup.
SiteVerification Component: Allows you to add site verification meta tags effortlessly by passing your verification ID. Different names can be assigned for various vendors to ensure compatibility.
Custom Domain Support: The component enables self-hosting of GTM containers, which is essential for server-side tracking and compliance with data privacy regulations.
Multiple Usage for Site Verification: Easily verify your site with various services using different site verification names by leveraging this component multiple times.
Flexible Configuration Options: Customize container paths and domains as needed to tailor the integration to your specific implementation requirements.
Installation Ease: The package can be installed quickly using npm or yarn, making it accessible for developers with varying levels of experience.