Solved

Link a button to trigger a Pop up Form

  • 21 February 2022
  • 2 replies
  • 1567 views

Badge +2

Basically I want a embedded form to appear when a button is clicked. Seems simple but I'm working with Klaviyo and Squarespace, these two are not linked to work together as opposed to other platforms such as BigCommerce, Shopify, etc. Squarespace has the option to put a button and link it to a URL or a document, but not to trigger some line of code, so I need to code inject into the squarespace page from scratch. I have the button but when i click on it, it doesn't trigger anything.

A few days ago Klaviyo uploaded this article to their Help Center https://help.klaviyo.com/hc/en-us/articles/4418052317339-How-to-Trigger-a-Popup-or-Flyout-Form-When-a-Button-Is-Clicked

https://developers.klaviyo.com/en/docs/how-to-custom-trigger-a-popup-or-flyout-form

I've been trying to make this work and I cannot find the solution, here's what I have so far:

 

<div class="sqs-block button-block sqs-block-button">
  <div align="center">
    <a id="klaviyo_form_trigger" class="sqs-block-button-element--medium sqs-button-element--primary sqs-block-button-element">Get the template</a>
  </div>
</div>

<script type="text/javascript" src="//www.klaviyo.com/media/js/public/klaviyo_subscribe.js" async="">
document.querySelector('#klaviyo_form_trigger').addEventListener('click',function (){
        var _klOnsite = window._klOnsite || []
        _klOnsite.openForm('FormID')
});
</script>

Just incase: yes, I have Klaviyo.js running, yes, I installed the form snippet, yes ,i have my personal FormID in my code

icon

Best answer by alex.hong 24 February 2022, 22:19

View original

2 replies

Userlevel 7
Badge +58

Hi there @luzst,

Welcome to the Community!

I’d like to start off by clarifying that you cannot create an embedded form to appear when a button is clicked. I believe you are referring to a flyout or popup if that is the case. If not feel free to clarify as well.

One thing worth noting from a Squarespace doc I found is that sometimes embedded code or content doesn't appear when you're logged in. As long as the code is valid, it should display to visitors. To check that visitors can see it, try logging out of your site and visiting it, or opening it in an incognito window. See source here.

 

All the best,

Alex

Badge +1

making use of CRM platform to trigger, and setting up form is limited with come certain website platform host,  and klaviyo isn’t supporting squarespace there are other   CRM platform which can serve same purpose and perform as features e.g mailchimp.

And you can also make use of zapier to connecct the work flow from squarespace to klaviyo 

for more support get in touch with bernardisaac0505 at g mail dot com

Reply