Move code for deleting old cookies into banner JS

Removes the following cookies:
- seen_cookie_message (flags if banner was already
  shown)
- _gid (Google Analytics cookie)
- _ga (Google Analytics cookie)

These were set by default before so potentially
still around for some users.

The code for this now exists as a static method on
the cookieMessage module and is called when the JS
loads for the first time.
This commit is contained in:
Tom Byers
2019-12-15 19:39:31 +00:00
parent fa7104d6c8
commit 1d864943c5
3 changed files with 13 additions and 9 deletions

View File

@@ -243,12 +243,4 @@
<!--[if gt IE 8]><!-->
<script type="text/javascript" src="{{ asset_url('javascripts/all.js') }}"></script>
<!--<![endif]-->
<script>
if (window.GOVUK.cookie('_ga') !== null) {
document.cookie = '_ga' + '=;expires=' + new Date() + ';domain=' + window.location.hostname.replace(/^www\./, '.') + ';path=/';
}
if (window.GOVUK.cookie('_gid') !== null) {
document.cookie = '_gid' + '=;expires=' + new Date() + ';domain=' + window.location.hostname.replace(/^www\./, '.') + ';path=/';
}
</script>
{% endblock %}