AEM Targeting (Contexthub) - Avoid default context to 'flash'

davids23429739

05-12-2019

Hi All,

I'm setting up Targeting using ContextHub as the engine for a project and it's pretty much done.

However, I noticed that when an audience matches a defined segment and the ContextHub replaces the default content with the targeted content it looks kinda ugly.

Is there a way to not display the default content for a component if it has a matching segment? I just don't want the end user to see how the default content appears and then when the JS runs it gets replaced with the targeted content. It looks weird.

This is an example of the JS that the contexthub injects.

<script type="text/javascript">

                if (window.ContextHub && ContextHub.SegmentEngine) {

                    ContextHubJQ(function() {

                        ContextHub.SegmentEngine.PageInteraction.Teaser({

                            locationId: '_id_of_my_component',

                            variants: [{..}]

                            strategy: '',

                            trackingURL: null

                        });

                    });

                }

</script>

After that piece of code runs, if the component matches a segment based on the defined traits then the default content is replace with the targeted one.

Is there a way to make this process little bit smoother, and avoid the display/hide of the default content?

Thanks!