This repository has been archived by the owner on Nov 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- note that this change depends upon analytics code being in the components gem, which at time of writing is not complete - analytics code is initialised on every page, if a previously set consent cookie is found, pageviews are sent - the registration flow includes a yes/no radio for cookie consent, choosing 'yes' sets the cookie and immediately reinitialises the analytics code, firing a pageview - if the user chooses 'no' that cookie is deleted - this preference is not currently tied to the record in the user profile although this may change
- Loading branch information
1 parent
1c92d49
commit e580764
Showing
5 changed files
with
49 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//= require govuk_publishing_components/analytics | ||
|
||
var linkedDomains = ['www.gov.uk'] | ||
|
||
$(document).ready(function() { | ||
if (typeof window.GOVUK.analyticsInit !== 'undefined') { | ||
window.GOVUK.analyticsInit(linkedDomains) | ||
|
||
$('.js-cookie-consent .govuk-radios__input').on('click', function() { | ||
var response = $(this).val() | ||
|
||
if (response === 'yes') { | ||
window.GOVUK.approveAllCookieTypes() | ||
window.GOVUK.cookie('cookies_preferences_set', 'true', { days: 365 }) | ||
window.GOVUK.analyticsInit(linkedDomains) | ||
} | ||
|
||
else { | ||
window.GOVUK.deleteCookie('cookies_policy') | ||
} | ||
}) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters