Repository navigation
change: [M3-8390] - Initialize Pendo on Cloud Manager - #10982
Conversation
| // Adapted Pendo install script for readability: | ||
|
|
||
| // Set up Pendo namespace and queue | ||
| const pendo = (window['pendo'] = window['pendo'] || {}); | ||
| pendo._q = pendo._q || []; | ||
|
|
||
| // Define the methods Pendo uses in a queue | ||
| const methodNames = [ | ||
| 'initialize', | ||
| 'identify', | ||
| 'updateOptions', | ||
| 'pageLoad', | ||
| 'track', | ||
| ]; | ||
|
|
||
| // Enqueue methods and their arguments on the Pendo object | ||
| methodNames.forEach((_, index) => { | ||
| (function (method) { | ||
| pendo[method] = | ||
| pendo[method] || | ||
| function () { | ||
| pendo._q[method === methodNames[0] ? 'unshift' : 'push']( | ||
| // eslint-disable-next-line prefer-rest-params | ||
| [method].concat([].slice.call(arguments, 0)) | ||
| ); | ||
| }; | ||
| })(methodNames[index]); | ||
| }); |
There was a problem hiding this comment.
All this stuff is a slightly more readable version of the Pendo install script: https://support.pendo.io/hc/en-us/articles/21362607464987-Components-of-the-install-script.
There was a problem hiding this comment.
would we need to cite this in our code?
There was a problem hiding this comment.
I don't think we need to as far as Pendo is concerned, but it's good context to have, since we set this up in a way that is consistent with our repo, deconstructing a bit to make use of our loadScript function. I added a link to the Pendo doc in a comment in the code so it's not just ephemerally in this PR - good call out.
| loadScript(PENDO_URL, { | ||
| location: 'head', | ||
| }).then(() => { | ||
| window.pendo.initialize({ |
There was a problem hiding this comment.
I left the commented-out sections for reference.
|
|
||
| declare global { | ||
| interface Window { | ||
| pendo: any; |
There was a problem hiding this comment.
Unfortunately, Pendo docs recommend typing this as any.
|
Coverage Report: ❌ |
bnussman-akamai
left a comment
There was a problem hiding this comment.
Script initialization looks good. Didn't 👁️ any issues
coliu-akamai
left a comment
There was a problem hiding this comment.
✅ confirmed pendo.validateEnvironment()
✅ confirmed no sensitive data is sent to Pendo
thanks Mariah! 🎉
|
Going to go ahead and merge this because CI was passing last week and today's updates shouldn't have impacted that; CI is just having known issues today. |
Description 📝
This PR adds Pendo to Cloud Manager by adding the Pendo agent script from the CDN and initializing Pendo with some custom configurations.
Changes 🔄
js-sha256usePendohookloadScriptApp.tsxwith the rest of the GlobalListenersTarget release date 🗓️
10/14/24
How to test 🧪
Prerequisites
(How to setup test environment)
.env, add the Pendo API Key. This is not a secret key; it will be visible in the browser dev tools, but we also want to be able to stop Pendo from running using an environment variable, which will live elsewhere with our env var configurations. See the internal repo (PR 167) for that change and the API key.Verification steps
(How to verify changes)
pendo.validateEnvironment(). This should output some data, including your hashed visitor and account id.pendoin the Network tab of the browser dev tools.normalizedUrlof the requests:linodes/123should be truncated tolinodes/)Example:

As an Author I have considered 🤔
Check all that apply