Expand my Community achievements bar.

SOLVED

How do we know when the Adobe Target activity finished loading on to the DOM

Avatar

Level 1

I want to dispatch a custom event from Adobe Target, once the Adobe Target Activity has been fully loaded on the DOM. (For example an Experience Fragment from Adobe Target replacing an AEM XF, and dispatchEvent should be triggered only once this is completed)
From AEM end, then the code will listen to this custom event and start processing something.

I've already tried adding a script from Adobe Target like this, but it didn't work as I expected.

Appreciate any advice on this.

 

<script>    
        window.onload = function() {
                const event = new Event("targetContentLoaded");
                window.dispatchEvent(event); 
        }
</script>


 

 

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @IndivariJa 

I think you can make a use of adobe target (at.js) custom events called Content Rendering Succeeded 

Constant: adobe.target.event.CONTENT_RENDERING_SUCCEEDED

String Value: at-content-rendering-succeeded

Description: Offer rendering was successful. DOM changes have been applied. 

and then from AEM end you can listen and process next 

 

Here is the link for more info - https://experienceleague.adobe.com/en/docs/target-dev/developer/client-side/at-js-implementation/fun... 

Hope this helps. 

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

Hi @IndivariJa 

I think you can make a use of adobe target (at.js) custom events called Content Rendering Succeeded 

Constant: adobe.target.event.CONTENT_RENDERING_SUCCEEDED

String Value: at-content-rendering-succeeded

Description: Offer rendering was successful. DOM changes have been applied. 

and then from AEM end you can listen and process next 

 

Here is the link for more info - https://experienceleague.adobe.com/en/docs/target-dev/developer/client-side/at-js-implementation/fun... 

Hope this helps. 

Avatar

Community Advisor

Hi @IndivariJa  Glad to know that its worked for you. 

Thanks