Skip to content

[PP-7355] Add usage tracking via Google Analytics 4#204

Merged
yndajas merged 3 commits intomainfrom
ga4-tracking
Nov 20, 2025
Merged

[PP-7355] Add usage tracking via Google Analytics 4#204
yndajas merged 3 commits intomainfrom
ga4-tracking

Conversation

@yndajas
Copy link
Copy Markdown
Member

@yndajas yndajas commented Nov 14, 2025

We want to know how much traffic these docs get

@yndajas yndajas force-pushed the ga4-tracking branch 2 times, most recently from dad470a to 6a34d48 Compare November 19, 2025 11:17
yndajas added a commit to alphagov/govuk-infrastructure that referenced this pull request Nov 19, 2025
The CodeQL action decides which languages to analyse based on the file
extensions present in a repo. However, if it analyses a language and
finds no analysable code, it will error

https://docs.github.com/en/code-security/code-scanning/troubleshooting-code-scanning/no-source-code-seen-during-build

This change will allow us to specify which languages should be analysed
so that we can exclude a language for which there's no analysable code

This does mean that if analysable code is later added to a repo where
its language has been ignored, we wouldn't be analysing it. That doesn't
feel great, but this seems to be a limitation of CodeQL

The following PR exhibited this error:
alphagov/govuk-content-api-docs#204. We have .js
files in that repo but they only contain (magic) comments. This wasn't
an issue with older versions of CodeQL. We're currently using 2.23.5 -
the last merged PR used 2.23.2 and passed the CodeQL checks:
alphagov/govuk-content-api-docs#203
yndajas added a commit to alphagov/govuk-infrastructure that referenced this pull request Nov 19, 2025
The CodeQL action decides which languages to analyse based on the file
extensions present in a repo. However, if it analyses a language and
finds no analysable code, it will error

https://docs.github.com/en/code-security/code-scanning/troubleshooting-code-scanning/no-source-code-seen-during-build

This change will allow us to specify which languages should be analysed
so that we can exclude a language for which there's no analysable code

https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning#changing-the-languages-that-are-analyzed

This does mean that if analysable code is later added to a repo where
its language has been ignored, we wouldn't be analysing it. That doesn't
feel great, but this seems to be a limitation of CodeQL

The following PR exhibited this error:
alphagov/govuk-content-api-docs#204. We have .js
files in that repo but they only contain (magic) comments. This wasn't
an issue with older versions of CodeQL. We're currently using 2.23.5 -
the last merged PR used 2.23.2 and passed the CodeQL checks:
alphagov/govuk-content-api-docs#203
yndajas added a commit to alphagov/govuk-infrastructure that referenced this pull request Nov 19, 2025
The CodeQL action decides which languages to analyse based on the file
extensions present in a repo. However, if it finds no analysable code
for one of those languages, it will error

https://docs.github.com/en/code-security/code-scanning/troubleshooting-code-scanning/no-source-code-seen-during-build

This change will allow us to specify which languages should be analysed
so that we can exclude a language for which there's no analysable code

https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning#changing-the-languages-that-are-analyzed

This does mean that if analysable code is later added to a repo where
its language has been ignored, we wouldn't be analysing it. That doesn't
feel great, but this seems to be a limitation of CodeQL

The following PR exhibited this error:
alphagov/govuk-content-api-docs#204. We have .js
files in that repo but they only contain (magic) comments. This wasn't
an issue with older versions of CodeQL. We're currently using 2.23.5 -
the last merged PR used 2.23.2 and passed the CodeQL checks:
alphagov/govuk-content-api-docs#203
This brings in support for using Google Tag Manager for Google Analytics
4
This config setting is used by the tech docs gem to add GA4 usage
tracking via the Google Tag Manager approach when users consent
This isn't Content API - it's documentation for Content API. The new
cookie banner would read "Cookies on Content API" without this change,
which is a little confusing
@yndajas yndajas marked this pull request as ready for review November 19, 2025 17:08
@yndajas yndajas merged commit 94efde8 into main Nov 20, 2025
6 checks passed
@yndajas yndajas deleted the ga4-tracking branch November 20, 2025 09:51
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