We have a react SPA. First page that the user goes to, it seems the "adobe" object is available, but target.getJsonOffer() is not there yet. Eventually it is there and we can execute it but not unless we do some sort of timeout functionality or force the SPA to re-render.
Is there some sort of mechanism to knowing when the getJsonOffer, triggerView, etc. functions are available so we can start firing them?
Solved! Go to Solution.
Hello,
I think, it should be other way around because target response is asynchronous you should be looking from page or component load side (same we have done in our side as well)
as and example refer - https://experienceleague.adobe.com/docs/target/using/implement-target/client-side/at-js-implementati...
as it rightly called out, how it should be done.
Hope it helps!!
Hello,
I think, it should be other way around because target response is asynchronous you should be looking from page or component load side (same we have done in our side as well)
as and example refer - https://experienceleague.adobe.com/docs/target/using/implement-target/client-side/at-js-implementati...
as it rightly called out, how it should be done.
Hope it helps!!
Not 100% sure I'm following. I can't even exectue the getJsonOffers() function to use its asynchronous functionality. As you can see in the screenshot - adobeVailable() function checks for adobe.target and adobe.target.getJsonOffer. As you can see, even the 'target' property isn't there yet for me to execute, thus it would cause runtime errors if I tried to.
I think the at-library-loaded event should do the trick.
Library Loaded
Constant: adobe.target.event.LIBRARY_LOADED
String Value: at-library-loaded
Description: This event is ideal to track when at.js has been fully loaded. You can use this event to customize global mbox execution. You can also use this event to disable the global mbox and then listen for this event to fire the global mbox later.
https://experienceleague.adobe.com/docs/target/using/implement-target/client-side/at-js-implementati...
Views
Like
Replies
Views
Like
Replies