Skip to content

Add GoatCounter analytics to all pages#1

Merged
srubinacci merged 2 commits intomainfrom
copilot/add-goatcounter-analytics
Mar 8, 2026
Merged

Add GoatCounter analytics to all pages#1
srubinacci merged 2 commits intomainfrom
copilot/add-goatcounter-analytics

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 8, 2026

Adds privacy-friendly GoatCounter analytics across all pages. Because index.astro imports Base directly (bypassing Page.astro), the script is placed in Base.astro rather than Page.astro to guarantee site-wide coverage.

Changes

  • src/layouts/Base.astro — injects GoatCounter script into <head> using the correct subdomain (compstatgenlab.goatcounter.com) and explicit https://; adds <slot name="head" /> for future extensibility
  • src/layouts/Page.astro — forwards a named head slot to Base.astro so consumers of Page.astro can inject additional head content
<!-- Base.astro -->
<script data-goatcounter="https://compstatgenlab.goatcounter.com/count"
        async src="https://gc.zgo.at/count.js"></script>
<slot name="head" />

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • telemetry.astro.build
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/compstatgenlab.github.io/compstatgenlab.github.io/node_modules/.bin/astro build (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Add GoatCounter analytics tracking to the website for simple privacy-friendly analytics.

Astro project does not use a single layout; most pages use a layout component (Base.astro) via src/layouts/Page.astro.

Steps:

  1. Update src/layouts/Base.astro so its <head> includes <slot name="head" />. (If already present, verify.)
  2. Update src/layouts/Page.astro to provide a <slot name="head"> containing:
<script data-goatcounter="https://compstatgenlab.goatcounter.com/count"
        async src="//gc.zgo.at/count.js"></script>
  1. Ensure the script uses the correct subdomain (compstatgenlab), not cothempstatgenlab.
  2. Verify that analytics is injected in all pages importing Page.astro (index, contact, software, etc.).

Goal: One PR to add GoatCounter analytics, with clear commit messages and details for maintainers.

This pull request was created from Copilot chat.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

- Add GoatCounter script tag to Base.astro <head> (covers all pages)
- Use explicit https:// URL instead of protocol-relative URL
- Add <slot name="head" /> to Base.astro for future extensibility
- Forward named head slot in Page.astro to Base.astro

Co-authored-by: srubinacci <17588501+srubinacci@users.noreply.github.com>
Copilot AI changed the title [WIP] Add GoatCounter analytics tracking to the website Add GoatCounter analytics to all pages Mar 8, 2026
@srubinacci srubinacci marked this pull request as ready for review March 8, 2026 14:56
@srubinacci srubinacci merged commit 6a147bc into main Mar 8, 2026
@srubinacci srubinacci deleted the copilot/add-goatcounter-analytics branch April 11, 2026 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants