Skip to content

Load ArpJS and generate a session id for correlation and tracking - #204

Open
jsandland wants to merge 3 commits into
stagefrom
arpjs
Open

Load ArpJS and generate a session id for correlation and tracking#204
jsandland wants to merge 3 commits into
stagefrom
arpjs

Conversation

@jsandland

@jsandland jsandland commented Aug 4, 2026

Copy link
Copy Markdown

Adds scripts/arp.js to load the Watson SDK per environment and call WatsonSdk.initAsync with a persisted session id, exposing the id and composite token globally for downstream consumers. CSP updates (Step 4 of the ARP integration guide) are pending client configuration and will follow in a separate change.

Resolves: MWPW-200860

Test URLs:

Adds scripts/arp.js to load the Watson SDK per environment and call
WatsonSdk.initAsync with a persisted session id, exposing the id and
composite token globally for downstream consumers. CSP updates (Step 4
of the ARP integration guide) are pending client configuration and
will follow in a separate change.
@aem-code-sync

aem-code-sync Bot commented Aug 4, 2026

Copy link
Copy Markdown

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
In case there are problems, just click a checkbox below to rerun the respective action.

  • Re-run all PSI checks
  • Re-run failed PSI checks
  • Re-sync branch
Commits

@aem-code-sync

aem-code-sync Bot commented Aug 4, 2026

Copy link
Copy Markdown
Page Scores Audits Google
📱 /?martech=off PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI
🖥️ /?martech=off PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

ARP-1280 client configuration is complete and registered under the
bacom client id, replacing the placeholder.
Aligns with the convention Universal Nav already uses
(window.adobeArp.sessionToken) instead of inventing a new global, so
future consumers like Brand Concierge can read session id/token from
one shared, predictable location.
Comment thread scripts/scripts.js
}
}

if (CONFIG.arp?.clientId) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

We might want an additional check here. For instance, does the document contain the brand-concierge class on any component, or does it have some sort of bc load trigger in metadata. We should discuss the options with @colloyd to see what is most reasonable. Likely something event driven will be better in the future, perhaps having bc dispatch and event when it loads, or Milo utils dispatch and event when it loads.

I know the import is done async, which is good, but the fewer network requests in scripts.js the better. This is non-blocking.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@JasonHowellSlavin @colloyd : do we want to use metadata here similar to guest token?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@JasonHowellSlavin @colloyd : do we want to use metadata here similar to guest token?

Hi @disha-akarte , I don't think so. We've two main ways of setting meta-data. Either a sitewide basis using a url slug regex (/*, /products/*) or on a page by page basis.

I think depending on when ARPjs needs to be available we can either have the brand-concierge component send a custom event that we listen to here in scripts, and load ARPjs while brand-concierge is initiating, or we check the DOM if the block is present. With the latter, the problem is that if brand concierge is loaded in a fragment etc. it won't appear in the DOM until it starts to load.

We can discuss further and brainstorm. Happy to have a quick meeting.

Comment thread scripts/arp.js

export default async function loadArp({ clientId, prodEnv, loadScript }) {
const sessionId = getArpSessionId();
window.adobeArp = { ...window.adobeArp, sessionId };

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can someone on milo confirm sharing the same name as UNav would be okay here?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@disha-akarte, @JasonHowellSlavin I would assume this is ok, as unav isn't present on bacom, so I don't expect collisions here.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Snehal confirmed this was okay @disha-akarte , do you think this is ready to merge and do e2e testing?

@disha-akarte disha-akarte left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, please check the comment

Comment thread scripts/arp.js

export default async function loadArp({ clientId, prodEnv, loadScript }) {
const sessionId = getArpSessionId();
window.adobeArp = { ...window.adobeArp, sessionId };

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Snehal confirmed this was okay @disha-akarte , do you think this is ready to merge and do e2e testing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants