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?
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
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
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.
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
Views
Likes
Replies
Views
Likes
Replies