Skip to content

Commit 60034d5

Browse files
committed
Only show cookie banner if consent required
We already have analytics code that doesn't depend on getting consent from users and we don't want that to break. So the consent process will be opt in via config, at least initially
1 parent d93209d commit 60034d5

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

lib/source/layouts/core.erb

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -52,29 +52,31 @@
5252
<script>document.body.className += ' js-enabled' + ('noModule' in HTMLScriptElement.prototype ? ' govuk-frontend-supported' : '');</script>
5353

5454
<div class="app-pane">
55-
<div class="govuk-cookie-banner" data-nosnippet role="region" aria-label="Cookies on <%= config[:tech_docs][:service_name] %>">
56-
<div class="govuk-cookie-banner__message govuk-width-container">
57-
<div class="govuk-grid-row">
58-
<div class="govuk-grid-column-two-thirds">
59-
<h2 class="govuk-cookie-banner__heading govuk-heading-m">
60-
Cookies on <%= config[:tech_docs][:service_name] %>
61-
</h2>
62-
<div class="govuk-cookie-banner__content">
63-
<p class="govuk-body">We’d like to use analytics cookies so we can understand how you use the service and make improvements.</p>
55+
<% if config[:tech_docs][:ga4_gtm_tracking_id].is_a?(String) && !config[:tech_docs][:ga4_gtm_tracking_id].empty? %>
56+
<div class="govuk-cookie-banner" data-nosnippet role="region" aria-label="Cookies on <%= config[:tech_docs][:service_name] %>">
57+
<div class="govuk-cookie-banner__message govuk-width-container">
58+
<div class="govuk-grid-row">
59+
<div class="govuk-grid-column-two-thirds">
60+
<h2 class="govuk-cookie-banner__heading govuk-heading-m">
61+
Cookies on <%= config[:tech_docs][:service_name] %>
62+
</h2>
63+
<div class="govuk-cookie-banner__content">
64+
<p class="govuk-body">We’d like to use analytics cookies so we can understand how you use the service and make improvements.</p>
65+
</div>
6466
</div>
6567
</div>
66-
</div>
67-
<div class="govuk-button-group">
68-
<button type="button" class="govuk-button" data-module="govuk-button">
69-
Accept analytics cookies
70-
</button>
71-
<button type="button" class="govuk-button" data-module="govuk-button">
72-
Reject analytics cookies
73-
</button>
74-
<a class="govuk-link" href="#">View cookies</a>
68+
<div class="govuk-button-group">
69+
<button type="button" class="govuk-button" data-module="govuk-button">
70+
Accept analytics cookies
71+
</button>
72+
<button type="button" class="govuk-button" data-module="govuk-button">
73+
Reject analytics cookies
74+
</button>
75+
<a class="govuk-link" href="#">View cookies</a>
76+
</div>
7577
</div>
7678
</div>
77-
</div>
79+
<% end %>
7880
<div class="app-pane__header toc-open-disabled">
7981
<a href="#content" class="govuk-skip-link" data-module="govuk-skip-link">Skip to main content</a>
8082

0 commit comments

Comments
 (0)