Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Target Community Q&A Coffee Break: On Wednesday, February 1 at 8am PT, Brent Kostak of the Adobe Target Product team will be joining us to answer your Target questions. To register and for more information, follow the link to the right.

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

Avatar

Level 1

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?

2 Replies

Avatar

Level 8

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

Level 3

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