AB-Test: Trigger JS-function at pageload | Community
Skip to main content
Level 2
September 10, 2020
Solved

AB-Test: Trigger JS-function at pageload

  • September 10, 2020
  • 1 reply
  • 1032 views

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?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Gaureshk_Kodag

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.

1 reply

Gaureshk_Kodag
Adobe Employee
Gaureshk_KodagAdobe EmployeeAccepted solution
Adobe Employee
September 10, 2020

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.