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
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

AB-Test: Trigger JS-function at pageload

janwal
Level 2
Level 2

I have a JS-Function window.addButton(text, url) that I want to trigger when the page is loaded. Each variant of ABC-Test loads the function with different input:

 

Variant A: window.addButton('test1', 'testUrl1')

Variant B: window.addButton('test2', 'testUrl2')

Variant C: window.addButton('test3', 'testUrl3')

 

What is the best way to implement this function in Adobe Target?

1 Accepted Solution
gaureshk3014423
Correct answer by
Level 8
Level 8

Hi @janwal 

You can use custom code option and write your code inside onload function. 

For eg. Window.onload = function(){window.addButton(text, url) };

If this is not getting fired you can place this code inside timeout function.

View solution in original post

1 Reply
gaureshk3014423
Correct answer by
Level 8
Level 8

Hi @janwal 

You can use custom code option and write your code inside onload function. 

For eg. Window.onload = function(){window.addButton(text, url) };

If this is not getting fired you can place this code inside timeout function.

View solution in original post