diff options
| author | Yuval Adam <_@yuv.al> | 2025-05-08 21:40:50 +0200 |
|---|---|---|
| committer | Yuval Adam <_@yuv.al> | 2025-05-08 22:27:03 +0200 |
| commit | f9b19e3adcd66a7859a8ed397beb0893c541adef (patch) | |
| tree | 319e76549af46ec10f511711bea026ed4a9a2993 | |
| parent | 62578e75e5b43f074f024d7a2ce39d1c2622bde2 (diff) | |
Fix GA
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | src/config.ts | 1 | ||||
| -rw-r--r-- | src/pages/index.astro | 14 |
3 files changed, 14 insertions, 3 deletions
@@ -16,5 +16,3 @@ $ npm run dev ## Deployment Deployment is automated from `master` branch via Vercel. - -<GoogleAnalytics gaId="G-31LHNP2G97" />
\ No newline at end of file diff --git a/src/config.ts b/src/config.ts new file mode 100644 index 0000000..22ac32e --- /dev/null +++ b/src/config.ts @@ -0,0 +1 @@ +export const GOOGLE_ANALYTICS_ID = "G-31LHNP2G97"; diff --git a/src/pages/index.astro b/src/pages/index.astro index c750c0a..6df6391 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -2,6 +2,7 @@ import Cidr from "../components/Cidr"; import "../styles/global.css"; +import { GOOGLE_ANALYTICS_ID } from "../config"; const metadata = { title: "Interactive visual CIDR and IP range calculator", @@ -15,8 +16,19 @@ const metadata = { <meta charset="utf-8" /> <link rel="icon" type="image/ico" href="/favicon.ico" /> <meta name="viewport" content="width=device-width" /> - <meta name="generator" content={Astro.generator} /> <title>{metadata.title}</title> + <script + async + src={`https://www.googletagmanager.com/gtag/js?id=${GOOGLE_ANALYTICS_ID}`} + ></script> + <script define:vars={{ GOOGLE_ANALYTICS_ID }} is:inline> + window.dataLayer = window.dataLayer || []; + function gtag() { + dataLayer.push(arguments); + } + gtag("js", new Date()); + gtag("config", GOOGLE_ANALYTICS_ID); + </script> </head> <body> <div |
