Update the javascript to work for www, non-www, and localhost

This commit is contained in:
Rebecca Law
2019-12-20 15:55:37 +00:00
parent 751cca9f7d
commit e0f9af8107
3 changed files with 6 additions and 6 deletions

View File

@@ -127,10 +127,10 @@
<script>
if (window.GOVUK.cookie('_ga') !== null) {
document.cookie = '_ga' + '=;expires=' + new Date() + ';domain=.' + window.location.hostname + ';path=/';
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 + ';path=/';
document.cookie = '_gid' + '=;expires=' + new Date() + ';domain=' + window.location.hostname.replace(/^www\./, '.') + ';path=/';
}
</script>

View File

@@ -237,10 +237,10 @@
<!--<![endif]-->
<script>
if (window.GOVUK.cookie('_ga') !== null) {
document.cookie = '_ga' + '=;expires=' + new Date() + ';domain=.' + window.location.hostname + ';path=/';
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 + ';path=/';
document.cookie = '_gid' + '=;expires=' + new Date() + ';domain=' + window.location.hostname.replace(/^www\./, '.') + ';path=/';
}
</script>
{% endblock %}

View File

@@ -128,10 +128,10 @@
<script>
if (window.GOVUK.cookie('_ga') !== null) {
document.cookie = '_ga' + '=;expires=' + new Date() + ';domain=.' + window.location.hostname + ';path=/';
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 + ';path=/';
document.cookie = '_gid' + '=;expires=' + new Date() + ';domain=' + window.location.hostname.replace(/^www\./, '.') + ';path=/';
}
</script>