Solved

Klaviyo signup forms with variants and trigger via javascript

  • 20 November 2023
  • 1 reply
  • 90 views

Badge +1

Hello,

We are trying to see if we can utilize the klaviyo forms while running an A\B test and trigger the form for specific variant base on our own logic on the website.
i only saw the ability to display the form via 
window._klOnsite = window._klOnsite || [];
window._klOnsite.push('openForm', 'FormID');
in the documentation it states the following:

  • When a form has an ongoing A/B test, this API simply triggers the form’s display. It is your A/B testing logic, which is separate, that determines which variation displays. If you have an A/B test where a variation of your form has a custom trigger, you will still need to add custom trigger code to your site.

is there a way that we can trigger the form with the specific variant, i.e. something like:
window._klOnsite.push('openForm', 'FormID', ‘variantA’);

thanks for your help,

icon

Best answer by Taylor Tarpley 21 November 2023, 21:28

View original

1 reply

Userlevel 7
Badge +60

hi @unique-username-007

 

Thanks for sharing your question with us! Happy to help and love the user name by the way 😂.

 

Unfortunately, the solution you suggested won’t work as the custom display logic you share above is only to display a general form. As the documentation you link states, the form that gets displayed using this code is based solely on the A/B test logic within the UI, not anything custom coded.

 

To achieve your goal, you will need to use a fully built custom form. It should also be noted that it would be subject to your own A/B test logic/condition as well.

 

Thank you for participating in the Community!

-Taylor 

Reply