Skip to content

Google Analytics: enable site-wide tracking with configuration#23

Closed
Copilot wants to merge 1 commit intogoogle-analyticsfrom
copilot/sub-pr-22
Closed

Google Analytics: enable site-wide tracking with configuration#23
Copilot wants to merge 1 commit intogoogle-analyticsfrom
copilot/sub-pr-22

Conversation

Copy link

Copilot AI commented Dec 17, 2025

Enables Google Analytics 4 tracking across the site using the minimal-mistakes-jekyll theme's custom head include pattern.

Changes:

  • Added _includes/google-analytics.html with gtag.js implementation reading tracking ID from site.analytics.google.tracking_id
  • Integrated via _includes/head/custom.html for site-wide coverage in the head section
  • Configuration in _config.yml provides single source of truth for tracking ID

Implementation:

<!-- _includes/google-analytics.html -->
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.analytics.google.tracking_id }}"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag() { dataLayer.push(arguments); }
  gtag('js', new Date());
  gtag('config', '{{ site.analytics.google.tracking_id }}');
</script>

Uses the theme's standard override point (_includes/head/custom.html) rather than layout modification for maintainability.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI self-assigned this Dec 17, 2025
Copilot AI mentioned this pull request Dec 17, 2025
Copilot AI changed the title [WIP] Enable Google Analytics tracking on home page Google Analytics: enable site-wide tracking with configuration Dec 17, 2025
Copilot AI requested a review from gapry December 17, 2025 19:43
@gapry gapry closed this Dec 17, 2025
@gapry gapry deleted the copilot/sub-pr-22 branch December 17, 2025 20: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