Skip to content

change: [M3-9347] - Switch to self hosting Pendo agent in Adobe Launch #12203

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

Conversation

mjac0bs
Copy link
Contributor

@mjac0bs mjac0bs commented May 12, 2025

Description 📝

We are making the change to self-host the Pendo agent scripts, rather than retrieve them from the CDN, at InfoSec's request as a security 'best practice'. See the ticket and ISR for more details.

This is to be rolled out either in the same release as the new Adobe Launch script or after. See the link to the open backend PR in our Jenkins config needed to update the staging and master environments; development/preview environments are already using the new script, which is testable in this PR.

Changes 🔄

  • Fixes a bug in the loadScript function that was preventing the promise from being returned correctly when a script to load already exists
    • We needed this because the Adobe Launch script is already loaded for Adobe Analytics, and Pendo will use it
  • Fixes a bug in the useAdobeAnalytics hook that was preventing the first page view (when the user visits the landing page) from firing
    • We needed this because the Adobe Launch script rule is configured to load the Pendo agent at page view
  • Replaces the CDN url with the Adobe Launch script url in the usePendo loadScript call
  • Cleans up a bunch of logic where we were handling Optanon consent checking; the Launch script handles this now
  • Updates the developer docs to reflect these changes

Target release date 🗓️

5/20/25 or 6/3/25

Preview 📷

Before After
Screenshot 2025-05-13 at 6 59 32 AM Screenshot 2025-05-13 at 7 09 28 AM

How to test 🧪

Prerequisites

(How to setup test environment)

  • Use the preview link to test this. Pendo events fire on preview environments and not locally currently, due to Adobe Launch checking for the Optanon consent cookie with the same domain.

Verification steps

(How to verify changes)

  • Follow the instructions in our developer docs to confirm that Pendo still loads using the self-hosted script and page view events are firing when clicking around the app
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 self-assigned this May 13, 2025
@mjac0bs mjac0bs marked this pull request as ready for review May 13, 2025 16:52
@mjac0bs mjac0bs requested review from a team as code owners May 13, 2025 16:52
@mjac0bs mjac0bs requested review from dmcintyr-akamai, hkhalil-akamai and hasyed-akamai and removed request for a team May 13, 2025 16:52
@linode-gh-bot
Copy link
Collaborator

Cloud Manager UI test results

🔺 2 failing tests on test run #5 ↗︎

❌ Failing✅ Passing↪️ Skipped🕐 Duration
2 Failing584 Passing6 Skipped114m 45s

Details

Failing Tests
SpecTest
lke-create.spec.tsCloud Manager Cypress Tests→LKE Cluster Creation » LKE Cluster Creation
lke-create.spec.tsCloud Manager Cypress Tests→LKE Cluster Creation with APL enabled » LKE Cluster Creation with APL enabled

Troubleshooting

Use this command to re-run the failing tests:

pnpm cy:run -s "cypress/e2e/core/kubernetes/lke-create.spec.ts"

@mjac0bs mjac0bs requested a review from dwiley-akamai May 13, 2025 18:37
React.useEffect(() => {
if (PENDO_API_KEY && hasConsentEnabled) {
Copy link
Contributor Author

@mjac0bs mjac0bs May 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's an explanation of why PR preview links aren't initializing Pendo correctly before this PR's changes:

  1. hasConsentEnabled was our check for the OptanonConsent cookie consent before loading the Pendo script. The preview environment doesn’t have the same domain as the cookie. The hasConsentEnabled check for the cookie only works in dev, staging, and prod environments. The hasConsentEnabled check has been failing this check for preview environments and that’s still the case in develop. This has been fine, because we didn't need Pendo to be configured in preview environments. We could bypass the consent check and confirm Pendo loads in our local environments.

  2. The new Adobe Launch script currently bypasses the consent check for only preview environments (side note: I've asked MADS if we can update this to bypass for local too), but until this PR is merged, our preview environments will still not be initializing Pendo because of 1. This PR got rid of just the consent check and confirmed this - Pendo loaded fine!

@mjac0bs mjac0bs added Ready for Review Analytics Relating to Analytics migration project or Adobe Analytics labels May 13, 2025
Copy link
Contributor

@hkhalil-akamai hkhalil-akamai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed the Pendo script loaded from the self-hosted source, initialized with the correct Account and Profile ID, and sent request when navigating between pages.

Comment on lines +33 to +36
// Fire the first page view for the landing page
window._satellite.track('page view', {
url: window.location.pathname,
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious as to why the first page view was not being sent through the useEffect below this one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, good question. history.listen only fires when the location changes, and when the user first loads the app, the location hasn't changed.

@mjac0bs mjac0bs added the Add'tl Approval Needed Waiting on another approval! label May 16, 2025
Copy link
Contributor

@hasyed-akamai hasyed-akamai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed Pendo loading, initializing, and tracking. LGTM. 🚢

@github-project-automation github-project-automation bot moved this from Review to Approved in Cloud Manager May 19, 2025
@hasyed-akamai hasyed-akamai added Approved Multiple approvals and ready to merge! and removed Add'tl Approval Needed Waiting on another approval! Ready for Review labels May 19, 2025
@mjac0bs mjac0bs merged commit dfaccd2 into linode:develop May 19, 2025
34 of 35 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Merged in Cloud Manager May 19, 2025
hasyed-akamai pushed a commit to hasyed-akamai/manager that referenced this pull request May 20, 2025
linode#12203)

* Load the agent from the AL script instead of CDN

* Remove the Optanon consent check for launch script to handle

* Try to add page view tracking on first page load

* Clean up cookie stuff

* Update docs

* Correct typo and stray console.log

* Add a try-catch

* Add console log for env vars to debug

* Fix numbering in docs

* Fix bug - resolve the promise in useScript if the script was already loaded

* Add changesets

* Update test spec to include new Launch script urls
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 Approved Multiple approvals and ready to merge!
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

4 participants