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

change: [M3-9159] - Enable Pendo based on OneTrust cookie consent #11564

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from

Conversation

mjac0bs
Copy link
Contributor

@mjac0bs mjac0bs commented Jan 23, 2025

Description 📝

This PR enables the Pendo analytics script based on the OneTrust cookie consent granted by the user in their cookie preferences. If users disable performance cookies, the Pendo script will not load.

Once we release this change to production, we should be able to change a setting in our Pendo app subscription that has disabled cookies and client side storage use. The Login team needs cookies enabled on our subscription to allow for journey tracking between the anonymous users on Login and Cloud Manager's users.

Changes 🔄

  • Updates the usePendo.js hook to check for consent enablement before loading the script
  • Creates new utility functions (getCookie, checkOptanonConsent) to handle this in analytics/utils.ts
  • Adds unit test coverage for new utils in analytics/utils.test.ts

Target release date 🗓️

2/11/25

How to test 🧪

Verification steps

(How to verify changes)

  • Check out this PR and go to http://localhost:3000

  • Log out of whatever account you're in. At login.linode.com, select Cookie Preferences at the bottom of the screen

  • Disable the Performance Cookies setting by toggling it off

  • In your code editor, go to L80 of usePendo.js and change the condition for const hasConsentEnabled = !APP_ROOT.includes('localhost') to remove the !. In this PR, we want to confirm that the OneTrust cookie works locally, but normally we don't want to have to do these steps to enable Pendo for local development.

  • Open the browser dev tools and go to Application > Cookies and view the table of cookies

  • Find the OptanonConsent cookie and copy its value to your clipboard. Be sure to uncheck the Show URL decoded option
    Screenshot 2025-01-24 at 10 45 57 AM

  • Add a new OptanonConsent cookie for localhost for testing purposes. We can't read cookies with a different domain with document.cookie. To add a new cookie, click an empty cell at the bottom of the table. Name it OptanonConsent and copy the value from the linode.com cookie into the localhost OptanonConsent cookie.

  • If you want to confirm that OptanonConsent is now being returned in document.cookie, use the browser console to log the value for document.cookie.

  • Refresh the page and confirm that Pendo has respected your cookie setting and NOT loaded, which you can do via any of the following:

    • Check the page HTML to confirm there is no Pendo script in the <head> tag (it's the script with content.psp.cloud.linode.com)
    • Filter network requests on psp. and confirm there are no requests
      Screenshot 2025-01-24 at 10 49 33 AM
    • In the browser console, log pendo.validateEnvironment() and confirm the command fails
      Screenshot 2025-01-24 at 10 49 16 AM
  • Repeat the steps above, but with an Enabled Performance Cookie setting to confirm Pendo is loaded and sending data

    • We can test this by editing the localhost OptanonConsent cookie value so that C0002%3A0 is C0002%3A1. C0002 is the 'Performance Cookie' group; 0 is disabled, 1 is enabled
      Screenshot 2025-01-24 at 10 50 15 AM
      Screenshot 2025-01-24 at 10 50 03 AM
  • Ensure tests pass:

yarn test analytics/utils
Author Checklists

As an Author, to speed up the review process, I considered 🤔

👀 Doing a self review
❔ Our contribution guidelines
🤏 Splitting feature into small PRs
➕ Adding a changeset
🧪 Providing/improving test coverage
🔐 Removing all sensitive information from the code and PR description
🚩 Using a feature flag to protect the release
👣 Providing comprehensive reproduction steps
📑 Providing or updating our documentation
🕛 Scheduling a pair reviewing session
📱 Providing mobile support
♿ Providing accessibility support


  • I have read and considered all applicable items listed above.

As an Author, before moving this PR from Draft to Open, I confirmed ✅

  • All unit tests are passing
  • TypeScript compilation succeeded without errors
  • Code passes all linting rules

@mjac0bs mjac0bs added the Analytics Relating to Analytics migration project or Adobe Analytics label Jan 23, 2025
@mjac0bs mjac0bs self-assigned this Jan 23, 2025
@bnussman-akamai

This comment was marked as off-topic.

@mjac0bs

This comment was marked as off-topic.

@mjac0bs mjac0bs force-pushed the M3-9159-pendo-one-trust branch from d64b33d to 0222cae Compare January 24, 2025 15:55
@bnussman-akamai

This comment was marked as off-topic.

@mjac0bs mjac0bs marked this pull request as ready for review January 24, 2025 18:36
@mjac0bs mjac0bs requested a review from a team as a code owner January 24, 2025 18:36
@mjac0bs mjac0bs requested review from bnussman-akamai and coliu-akamai and removed request for a team January 24, 2025 18:36
Copy link

Coverage Report:
Base Coverage: 79.11%
Current Coverage: 79.12%

@linode-gh-bot
Copy link
Collaborator

Cloud Manager UI test results

🎉 482 passing tests on test run #5 ↗︎

❌ Failing✅ Passing↪️ Skipped🕐 Duration
0 Failing482 Passing2 Skipped96m 31s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Analytics Relating to Analytics migration project or Adobe Analytics Ready for Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants