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 || l]
_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