Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

AEM Personalization events

Avatar

Level 3

I need to perform some logic after a targeted component had been rendered on the page.  We are using a campaign, segments to display targeted content.  Is there a dom event I can listen to to know the personalized component has been added to the page?  I have the below code but it no long seem to work. 

$CQ('div').on('target-dom-loaded', function(event) { console.debug("*******************  target-dom-loaded ****************"); });
10 Replies

Avatar

Level 10

This is not documented - i am looking into this. 

Avatar

Level 10

try with “teaser-loaded”

Avatar

Level 3

My engine choice is ContextHub and I'm using the default target option on the component.  I don't see 'teaser-loaded' getting called either.

Avatar

Level 3

So target-dom-loaded event fires as long as I do not set the engine.

Avatar

Level 10

Hi

Watch this Ask the community experts topic on personalization topic
// https://communities.adobeconnect.com/p9neqyup4j5/?launcher=false&fcsContent=true&pbMode=normal

Hope this might help to you

Thanks,
Ratna Kumar.

Avatar

Level 3

The solution was to target 'segment-engine:teaser-loaded' event.

Avatar

Level 1

'bfvaughn' is correct in that the 'segment-engine:teaser-loaded' is the event fired.

I'm unsure as to whether this event is fired when 'all teasers' are loaded or 'just the first teaser' on a page is loaded.

This event was fired when using the 'Target Component' in AEM 6.2 using the 'ContextHub' Strategy.

The only way I was able to listen to this event inside a clientlib for a component was to use the ContextHub.Eventing as it did not get detected when using a normal jQuery.on() approach.

This is the snippet that worked for me:

window.ContextHub.eventing.on(ContextHub.SegmentEngine.PageInteraction.Teaser.prototype.info.loadEvent, function() {

  // for each component that now exists on the page...

});

Regards,

Ed

Avatar

Level 1

I am not able to detect "segment-engine:teaser-loaded" event on AEM6.1 SP2 and we have not enabled ContextHub. Any help is appreciated.

Avatar

Level 1

I think this event is fired every time any component is loaded, is it possible to know wich element triggered the event?

Avatar

Level 2

How did you get this code? Any sources we can check? OR just reading the source code?