Expand my Community achievements bar.

Join Cristinel Anastasoaie, Timothy Furlow, and Brent Kostak, WEDNESDAY, 2/28/24 @8am PT for the next Adobe Target Community Q&A Coffee Break on topics from the recent High Performance Recommendations Webinar PT 2 of the ongoing Target Personalization Maturity Webinar Series
SOLVED

Question regarding when the script runs in Target for A/B Test

Avatar

Level 2

Hello everyone. I'm working on a project where I have to dynamically change the text of a set of buttons across a site for an A/B test. The problem I am facing is the content is dynamically generated with a script in the body of the HTML, so whenever I try to update with custom code, it runs in the head and does not update the content. Does anyone have any suggestions or has performed a similar function in a test in Target?

Topics

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

1 Accepted Solution

Avatar

Correct answer by
Level 4

If possible, I would recommend using the at.js 2.x library and using a triggerView() to apply changes once the dynamic content has been rendered.

The other benefit of this approach is your offers will be "prefetched" on the initial page load.

 

These docos have more detail:

Target v2 Launch Extension - https://experienceleague.adobe.com/docs/experience-platform/tags/extensions/client/target-v2/overvie... 

Using VEC on SPA's - https://experienceleague.adobe.com/docs/target/using/experiences/spa-visual-experience-composer.html 

View solution in original post

2 Replies

Avatar

Community Advisor

Hi @aaronlng_92 you need to write the javascript code  in the code editor. you can use the setInterval function to check and get the value of button label. 

Once you get it, you can use the value to replace button label/text.

 

Avatar

Correct answer by
Level 4

If possible, I would recommend using the at.js 2.x library and using a triggerView() to apply changes once the dynamic content has been rendered.

The other benefit of this approach is your offers will be "prefetched" on the initial page load.

 

These docos have more detail:

Target v2 Launch Extension - https://experienceleague.adobe.com/docs/experience-platform/tags/extensions/client/target-v2/overvie... 

Using VEC on SPA's - https://experienceleague.adobe.com/docs/target/using/experiences/spa-visual-experience-composer.html