diff --git a/app/assets/javascripts/modules/global-bar.js b/app/assets/javascripts/modules/global-bar.js index b4d0ed47b..738ddf728 100644 --- a/app/assets/javascripts/modules/global-bar.js +++ b/app/assets/javascripts/modules/global-bar.js @@ -10,6 +10,7 @@ Modules.GlobalBar = function() { this.start = function($el) { var GLOBAL_BAR_SEEN_COOKIE = "global_bar_seen"; + var always_on = $el.data("global-bar-permanent"); // If the cookie is not set, let's set a basic one if (GOVUK.getCookie(GLOBAL_BAR_SEEN_COOKIE) === null || JSON.parse(GOVUK.getCookie(GLOBAL_BAR_SEEN_COOKIE))["count"] === undefined) { @@ -25,7 +26,9 @@ if ($el.is(':visible')) { - incrementViewCount(count); + if (!always_on) { + incrementViewCount(count); + } track('Viewed'); } diff --git a/app/views/notifications/_global_bar.html.erb b/app/views/notifications/_global_bar.html.erb index 77d30a6e8..78fbf489a 100644 --- a/app/views/notifications/_global_bar.html.erb +++ b/app/views/notifications/_global_bar.html.erb @@ -4,6 +4,11 @@ title_href = "/register-to-vote" link_text = "Register by 26 November to vote in the General Election on 12 December." link_href = false + + # Toggles banner being permanently visible + # If true, banner is always_visible & does not disappear automatically after 3 pageviews + # Regardless of value, banner is always manually dismissable by users + always_visible = false -%> <% if show_global_bar %> @@ -19,7 +24,7 @@ <% end %> -
+
>

<% if title %>