-
Notifications
You must be signed in to change notification settings - Fork 53
Add google analytics to download page #1240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -31,6 +31,17 @@ const optimizedDist = { ...distData, icon: optimizedIcon }; | |||||||||||||||||||||||||
| src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5235469391524556" | ||||||||||||||||||||||||||
| crossorigin="anonymous"></script> | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| <!-- Google tag (gtag.js) --> | ||||||||||||||||||||||||||
| <script | ||||||||||||||||||||||||||
| async src="https://www.googletagmanager.com/gtag/js?id=G-E3BVDYNVRP"></script> | ||||||||||||||||||||||||||
| <script> | ||||||||||||||||||||||||||
| window.dataLayer = window.dataLayer || []; | ||||||||||||||||||||||||||
| function gtag(){dataLayer.push(arguments);} | ||||||||||||||||||||||||||
| gtag('js', new Date()); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| gtag('config', 'G-E3BVDYNVRP'); | ||||||||||||||||||||||||||
|
Comment on lines
+37
to
+42
|
||||||||||||||||||||||||||
| <script> | |
| window.dataLayer = window.dataLayer || []; | |
| function gtag(){dataLayer.push(arguments);} | |
| gtag('js', new Date()); | |
| gtag('config', 'G-E3BVDYNVRP'); | |
| <script is:inline> | |
| const dataLayer = window.dataLayer = window.dataLayer || []; | |
| window.gtag = window.gtag || function gtag(){dataLayer.push(arguments);} | |
| window.gtag('js', new Date()); | |
| window.gtag('config', 'G-E3BVDYNVRP'); |
Copilot
AI
Apr 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The GA measurement ID is hard-coded here. To make it easier to change per-environment (staging/prod) and keep tracking IDs centralized, consider reading it from config/env (similar to how src/config/site.ts uses import.meta.env.PUBLIC_*) and only rendering the tag when the ID is set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These
<script>tags are rendered before<BaseLayout>, butBaseLayout.astrooutputs the document<!doctype html><html><head>...(src/layouts/BaseLayout.astro:35+). That means this page will emit scripts before the doctype/html element, producing invalid document structure (and potentially quirks mode / scripts not where expected). Move the GA (and the existing AdSense) tags into the layout<head>(e.g., add a named head slot inBaseLayoutand pass them via the page) so they render inside<head>.