Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/pages/download/[name].astro
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Comment on lines +34 to +36
Copy link

Copilot AI Apr 16, 2026

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>, but BaseLayout.astro outputs 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 in BaseLayout and pass them via the page) so they render inside <head>.

Copilot uses AI. Check for mistakes.
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'G-E3BVDYNVRP');
Comment on lines +37 to +42
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Astro, an inline <script> in a .astro template is processed/bundled as a module unless marked is:inline. In module scope, dataLayer is not a global binding, so dataLayer.push(...) will throw a ReferenceError when gtag() runs. Fix by making this script is:inline (classic script semantics) and/or by referencing window.dataLayer explicitly (e.g., assign a local const dataLayer = window.dataLayer = window.dataLayer || []) and attaching gtag to window if it needs to be globally callable.

Suggested change
<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 uses AI. Check for mistakes.
Comment on lines +35 to +42
Copy link

Copilot AI Apr 16, 2026

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.

Copilot uses AI. Check for mistakes.
</script>

<BaseLayout
title={"Downloads for " + distData.name}
breadcrumbs={distData.name + " | Downloads"}
Expand Down
Loading