Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 82b8807

Browse files
committedMar 21, 2025·
Load the agent from the AL script instead of CDN
1 parent 52af395 commit 82b8807

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed
 

‎packages/manager/src/hooks/usePendo.ts

+19-19
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import { loadScript } from '@linode/utilities'; // `loadScript` from `useScript`
33
import { sha256 } from 'js-sha256';
44
import React from 'react';
55

6-
import { APP_ROOT, PENDO_API_KEY } from 'src/constants';
7-
import {
8-
ONE_TRUST_COOKIE_CATEGORIES,
9-
checkOptanonConsent,
10-
getCookie,
11-
} from 'src/utilities/analytics/utils';
6+
import { ADOBE_ANALYTICS_URL, APP_ROOT, PENDO_API_KEY } from 'src/constants';
7+
// import {
8+
// ONE_TRUST_COOKIE_CATEGORIES,
9+
// checkOptanonConsent,
10+
// getCookie,
11+
// } from 'src/utilities/analytics/utils';
1212

1313
declare global {
1414
interface Window {
@@ -72,21 +72,21 @@ export const usePendo = () => {
7272
const accountId = hashUniquePendoId(account?.euuid);
7373
const visitorId = hashUniquePendoId(profile?.uid.toString());
7474

75-
const optanonCookie = getCookie('OptanonConsent');
76-
// Since OptanonConsent cookie always has a .linode.com domain, only check for consent in dev/staging/prod envs.
77-
// When running the app locally, do not try to check for OneTrust cookie consent, just enable Pendo.
78-
const hasConsentEnabled =
79-
APP_ROOT.includes('localhost') ||
80-
checkOptanonConsent(
81-
optanonCookie,
82-
ONE_TRUST_COOKIE_CATEGORIES['Performance Cookies']
83-
);
75+
// const optanonCookie = getCookie('OptanonConsent');
76+
// // Since OptanonConsent cookie always has a .linode.com domain, only check for consent in dev/staging/prod envs.
77+
// // When running the app locally, do not try to check for OneTrust cookie consent, just enable Pendo.
78+
// const hasConsentEnabled =
79+
// APP_ROOT.includes('localhost') ||
80+
// checkOptanonConsent(
81+
// optanonCookie,
82+
// ONE_TRUST_COOKIE_CATEGORIES['Performance Cookies']
83+
// );
8484

8585
// This URL uses a Pendo-configured CNAME (M3-8742).
86-
const PENDO_URL = `https://content.psp.cloud.linode.com/agent/static/${PENDO_API_KEY}/pendo.js`;
86+
// const PENDO_URL = `https://content.psp.cloud.linode.com/agent/static/${PENDO_API_KEY}/pendo.js`;
8787

8888
React.useEffect(() => {
89-
if (PENDO_API_KEY && hasConsentEnabled) {
89+
if (ADOBE_ANALYTICS_URL && PENDO_API_KEY) {
9090
// Adapted Pendo install script for readability
9191
// Refer to: https://support.pendo.io/hc/en-us/articles/21362607464987-Components-of-the-install-script#01H6S2EXET8C9FGSHP08XZAE4F
9292

@@ -118,7 +118,7 @@ export const usePendo = () => {
118118
});
119119

120120
// Load Pendo script into the head HTML tag, then initialize Pendo with metadata
121-
loadScript(PENDO_URL, {
121+
loadScript(ADOBE_ANALYTICS_URL, {
122122
location: 'head',
123123
}).then(() => {
124124
window.pendo.initialize({
@@ -166,5 +166,5 @@ export const usePendo = () => {
166166
});
167167
});
168168
}
169-
}, [PENDO_URL, accountId, hasConsentEnabled, visitorId]);
169+
}, [ADOBE_ANALYTICS_URL, accountId, visitorId]);
170170
};

0 commit comments

Comments
 (0)
Please sign in to comment.