Skip to main content
Warning This document has not been updated for a while now. It may be out of date.
Last updated: 27 Jul 2023

Deploy non-emergency global banner

A site-wide (global) banner can be activated to convey important information on GOV.UK which is not deemed emergency-level information. Unlike the emergency banner, we show a user the global banner no more than 3 times, by storing the view count in a cookie.

The content of the global banner is contained in app/views/components/_global_bar.html.erb in Static.

Activate the global banner

In app/views/components/_global_bar.html.erb:

  1. Update the variables title, title_href, link_href and link_text with the relevant info where applicable, otherwise set them to false.
  2. Change the value of show_global_bar to true.
  3. Optional: set the always_visible boolean to true if the banner should not disappear after being seen 3 times.
  4. Deploy Static. See the guidance on deploying Static.

screenshot

Exclude specific pages from showing the banner

The target page linked to from the banner will automatically not show the banner.

To prevent other pages from showing the banner, add them to urlBlockList in app/assets/javascripts/global-bar-init.js in Static.

Update the global banner version

The number of times a user has viewed the banner is stored in a global_bar_seen cookie. Once the view count reaches 3, that user will not see that banner again, even if new banner content is deployed.

The user will only see the banner again after the third time if either:

  • their global_bar_seen cookie expires, or
  • the version field in their cookie differs from the value of BANNER_VERSION in global-bar-init.js

To show the global banner again for all users including those who have already seen it 3 times:

  1. Increment the value of BANNER_VERSION in global-bar-init.js.
  2. Deploy Static.

Remove the global banner

  1. In app/views/components/_global_bar.html.erb, change the value of show_global_bar to false.
  2. Deploy Static.

Troubleshoot the banner

  1. Check that your rollout of Static succeeded, for example by checking when Static was last synced in Argo CD (staging, production).
  2. Make sure you are looking at the same environment where you deployed your change to Static.
  3. Use a fresh private/Incognito window so that your testing is not affected by browser state such as cookies or cache.
  4. Wait 5–10 minutes for caches to expire, then repeat the previous step.

If the banner is still not showing, there may be a bug or misconfiguration somewhere. You might be able to work around the problem temporarily until the underlying issue is fixed.

  1. Try clearing the frontend memcache. Log into the AWS web console for the appropriate environment, find frontend-memcached-govuk under Elasticache, Memcached clusters and press the Reboot button. The UI will ask you to confirm the request.
  2. Consider clearing the page from the CDN cache. Most pages expire from the CDN cache within 5 minutes so this is unlikely (though not impossible) to be the issue.