Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add single cookie consent API #3854

Merged
merged 7 commits into from Mar 8, 2024
Merged

Add single cookie consent API #3854

merged 7 commits into from Mar 8, 2024

Commits on Mar 8, 2024

  1. Configuration menu
    Copy the full SHA
    88c9f34 View commit details
    Browse the repository at this point in the history
  2. Add single consent library

    - adds code to include and manage our use of the single consent API code
    - init is called by the cookie banner code on every page, which determines which API endpoint to use (staging or prod) and creates the GovSingleConsent object
    - useConsentApi is called across the code to check whether or not to use the consent API, this will be set in static
    - the default callback for the consent object checks the returned response and if the user has consented, triggers the cookie-consent event, which will initialise analytics and hide the cookie banner
    - setPreferences allows user consent to be set through the API
    - use load analytics environment list for consent API URL
    andysellick committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    fe5418e View commit details
    Browse the repository at this point in the history
  3. Cookie banner use single consent API

    - update the cookie banner component JS to use the single consent API code
    - stores an internal variable to check whether or not to use the consent API
    - if false, behaviour should be as normal
    - if true, should yield setting of consent cookies entirely to the consent API code
    - update cookie banner tests accordingly
    andysellick committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    661980b View commit details
    Browse the repository at this point in the history
  4. Cookie settings use single consent API

    - updates the JavaScript for the cookie settings page to use the single consent API code
    - stores an internal variable to check whether or not to use the consent API
    - if false, behaviour should be as normal
    - if true, should yield setting of consent cookies entirely to the consent API code
    - note that this code sends its own callback function for the consent API, which sets the initial form values on page load, this means that any delay in the API call will result in these fields being unfilled until it responds
    andysellick committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    b34a892 View commit details
    Browse the repository at this point in the history
  5. Default Youtube videos to off

    - previously the consent cookie was always set (to reject all cookies) prior to user choice
    - now that we're not doing that, the code that turns links to Youtube videos in govspeak content into embedded videos was checking for the consent cookie, not finding it, and defaulting to... true.
    - this meant that videos were appearing on a page before users had consented to cookies
    - setting the default value to false seems to be the simplest way to fix this. Videos still initialise automatically as before once cookies are consented to
    andysellick committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    d21cc1e View commit details
    Browse the repository at this point in the history
  6. Refactor domain configuration for load-analytics

    - now that the domain config contains information about more than just analytics, it feels like it should be separated out for clarity
    - updated docs and tests accordingly
    andysellick committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    743b298 View commit details
    Browse the repository at this point in the history
  7. Update changelog

    andysellick committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    7b5f751 View commit details
    Browse the repository at this point in the history