SDID issue in an SPA with multiple MBox-es
I am adding personalization to an Angular SPA application. I am using A4T, and need your advice regarding how to connect mbox display events with analytics "page load" requests.
I am using the form-based composer as the application has a logged-in-only experience, and there is no way to pass through the login process in the VEC (top-frame redirects). I defined several mbox-es, and use them as locations in activities. When the application loads, it issues a prefetch request to Target to retrieve all applicable offers.
When the user navigates to a specific route component ("page"), the app renders the applicable offers as recommended on this page https://experienceleague.adobe.com/en/docs/target-dev/developer/client-side/at-js-implementation/functions-overview/adobe-target-getoffers-atjs-2:
mboxes.forEach(el => {
let selectorExpr = ".mbox-name-" + el.name;
if (el.options) {
if (document.querySelector(selectorExpr)) {
adobe.target.applyOffers({
selector: selectorExpr,
response: {
prefetch: {
mboxes: [el]
}
}
});
}
}
});
After that, the application makes an s.t() call to send a "page load" request to Adobe Analytics.
The problem occurs when there are two or more mbox-es on one route component ("page"), and each of them has an applicable offer. In that case, adobe.target.applyOffers() is called multiple times, generating several Supplemental Data ID-s (sdid). And the subsequent analytics request contains only the first sdid, which means that the offers in the other mboxes are not associated with that "page view" (s.t()). I cannot combile several mbox-es in one "applyOffers" as the selectors are different.
Could you please suggest how I can solve the problem? Is, for example, any of the following possible?
- specify multiple selectors in applyOffers(), provided that I am using a form-based composer
- suppress sending a notification to Target in applyOffers() so that I can send a notification in a separate call.
Maybe my entire vision of how A4T works for SPA is incorrect, so any help will be appreciated.
