JSPM

@aqzhyi/google-analytics

0.3.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 10
  • Score
    100M100P100Q44358F
  • License MIT

Google Analytics (GA4) library

Package Exports

  • @aqzhyi/google-analytics

Readme

@aqzhyi/google-analytics

Google Analytics (GA4) library

Install

pnpm i @aqzhyi/google-analytics

<GoogleAnalytics /> (astro-component)

Insert the GTM (Google Tag Manager) script into the Astro Layout and configure your Google Analytics ID, for example: 'G-G90JYXXXXX'.

pages/_layout/BasicLayout.astro
---
import { GoogleAnalytics } from "@aqzhyi/google-analytics"
---

<!doctype html>
<html>
  <head>
    <GoogleAnalytics id='G-G90JYXXXXX' />
  </head>
  <body>
    <slot />
  </body>
</html>
pages/index.astro
---
import BasicLayout from "./_layout/BasicLayout.astro"
---

<BasicLayout>
  Page 1
</BasicLayout>
Preview

<GoogleAnalytics debug /> (astro-component)

<GoogleAnalytics
  id=''
  debug={true}
/>