Skip to content
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

Ga4 consent #4558

Merged
merged 2 commits into from Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions data/analytics/navigation.yml
Expand Up @@ -23,6 +23,8 @@ docs:
subsections:
- name: Development approach
link: approach.html
- name: Consent handling
link: consent.html
- name: Personally identifiable information
link: pii.html
- name: Trackers
Expand All @@ -38,6 +40,9 @@ progress:
approach:
name: Development approach

consent:
name: Consent handling

pii:
name: Personally Identifiable Information

Expand Down
15 changes: 15 additions & 0 deletions source/analytics/consent.html.md.erb
@@ -0,0 +1,15 @@
<% content_for :title, create_page_title(data.analytics.navigation.consent.name) %>

<h1 class="govuk-heading-l">
<%= data.analytics.navigation.consent.name %>
</h1>

<p class="govuk-body">The <a href="https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics-ga4/consent.md" class="govuk-link">GOV.UK analytics JavaScript</a> has been implemented so that no analytics code is run until users consent to cookies. This includes calling the GA4/GTM script from Google.</p>

<p class="govuk-body">This JavaScript implements a blocklist when initialising Google Tag Manager. This <a href="https://github.com/alphagov/govuk_publishing_components/blob/494c9fdbc50365a902e3e49a32b5417a4a761aad/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-core.js#L16" class="govuk-link">prevents various items from being included</a> from GTM, such as custom scripts and HTML.</p>

<p class="govuk-body">Additionally, consent has been configured in GTM as an additional layer of certainty. All tags have the Exception - All Events - Declined Cookies exception (blocking trigger) applied, which prevents the tags from firing if the user's consent cookie does not match "usage":true.</p>

<p class="govuk-body">The trigger leverages a Lookup variable (LT - cookies_policy - check) that returns 'true' where the string matches and 'false' where it does not. The exception then evaluates to TRUE (and will block tags from firing) when the LT - cookies_policy - check returns false.</p>

<p class="govuk-body">Another exception (Exception - All Events - hostname filter) has also been added to all tags that prevents them from firing unless the Page Hostname matches one of the specified dev, integration, staging or production gov.uk domains.</p>
7 changes: 6 additions & 1 deletion source/analytics/docs.html.md.erb
Expand Up @@ -14,4 +14,9 @@
<% end %>
</ul>

<p class="govuk-body">Our main documentation source is <a href="https://github.com/alphagov/govuk_publishing_components" class="govuk-link">govuk_publishing_components</a>. This is where <a href="https://github.com/alphagov/govuk_publishing_components/tree/main/app/assets/javascripts/govuk_publishing_components/analytics-ga4" class="govuk-link">our analytics code</a> is located. Read our <a href="https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics-ga4/analytics.md" class="govuk-link">overview of our GA4 code</a> for more information.</p>
<p class="govuk-body">Further documentation can be found below.</p>

<ul class="govuk-list govuk-list--bullet">
<li>Documentation relating to the GA4 code on GOV.UK can be found in <a href="https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics-ga4/analytics.md" class="govuk-link">govuk_publishing_components</a>.</li>
<li>Documentation for the GOV.UK data community can be found in <a href="https://docs.data-community.publishing.service.gov.uk/" class="govuk-link">Data Services technical documentation</a>.</li>
</ul>