mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-06 11:23:48 -05:00
We have been clearing all the Google Analytics cookies on each page request. It is now possible for a user to consent to having Google Analytics cookies so this should have been checking for that before deleting them. This makes that change, with tests for those scenarios.
16 lines
407 B
JavaScript
16 lines
407 B
JavaScript
(function (window) {
|
|
"use strict";
|
|
|
|
function hasConsentFor (cookieCategory, consentCookie) {
|
|
if (consentCookie === undefined) { consentCookie = window.GOVUK.getConsentCookie(); }
|
|
|
|
if (consentCookie === null) { return false; }
|
|
|
|
if (!(cookieCategory in consentCookie)) { return false; }
|
|
|
|
return consentCookie[cookieCategory];
|
|
}
|
|
|
|
window.GOVUK.hasConsentFor = hasConsentFor;
|
|
})(window);
|