wellcomecollection / wellcomecollection.org

🪟 Wellcome Collection's website and services that support it
https://wellcomecollection.org
MIT License
37 stars 5 forks source link

Segment script and cookie consent changes #10964

Open rcantin-w opened 2 weeks ago

rcantin-w commented 2 weeks ago

We're using Segment in this case as we already have it, but we'll want the same behaviour for the pixel tracking scripts.

Current behaviour

  1. User lands on website
  2. Users selects "Essential only" in cookies
  3. Segment script does not load
  4. User goes to Cookie Management modal and consents to "analytics" cookies, leaves the modal.
  5. Segment script does not load
  6. User navigates to next page/reloads current page
  7. Segment script gets loaded and triggers.

then

  1. User goes back to Cookie Management modal and revokes his "analytics" consent.
  2. Segment script is not removed, nor as associated cookies
  3. User navigates to next page/reloads current page
  4. Segment script is removed, as are associated cookies.

Expected behaviour

  1. User lands on website for the first time
  2. Accepts all cookies
  3. Segment script loads

or

  1. User lands on website for the first time
  2. Essential cookies only
  3. Segment script does not loads

and

  1. User lands on website
  2. Users selects "Essential only" in cookies
  3. Segment script does not load
  4. User goes to Cookie Management modal and consents to "analytics" cookies, leaves the modal.
  5. Segment script was added on consent change and triggers

then

  1. User goes back to Cookie Management modal and revokes his "analytics" consent.
  2. Segment script is removed, as are associated cookies

Things to look into:

Done when

rcantin-w commented 16 hours ago

PR was approved but because we'd like to keep an eye on the results and effects and I'm off tomorrow, I suggest we wait until Monday to deploy.