/
Squarespace integration

Squarespace integration

Generate script

Use the Salesforce client configuration tool, or create the snippet and configuration manually. Apply the following settings:

  • formSelector: Squarespace does not offer an easy method to add CSS classes to forms or containers, so this will generally need to use existing selectors. For example:

    • ‘form’ to simply attach to all forms on the website.

    • ‘.newsletter-block form’ to attach to the form inside the newsletter block. Multiple selectors may be used with comma separators.

  • formListenOnButton: enable this setting so that Send2CRM creates a replacement submit button to handle sending. If not set the default Squarespace JavaScript handler will override Send2CRM.

  • formIdAttributes: set to “data-form-id”. Squarespace changes the form id on every page load so it isn't a reliable identifier, this data attribute remains the same.

Example:

<script> (function(s,e,n,d2,cr,m){n[e]=n[e]||{};m=document.createElement('script');m.onload=function(){n[e].init(d2,cr);};m.src=s;document.head.appendChild(m);})('https://cdn.jsdelivr.net/gh/FuseInfoTech/send2crmjs/send2crm.min.js', 'send2crm', window, 'my-site.my.salesforce-sites.com', '(key)'); window.addEventListener('send2crmLoading', (evt) => { send2crm.applySettings({ formSelector: '.newsletter-block form, .other-block-form form', formListenOnButton: true, formIdAttributes: ['data-form-id'], }); }); </script>

Apply script to all pages

Add the script to all website pages.

Go to Website > Website Tools > Code Injection in Squarespace. Enter the script in the header, with enclosing <script> tags. Save changes.

Map forms

The Send2CRM client is now installed in Squarespace. Capture a submission from each applicable form to set it up in the mapping wizard.

Use the ‘data-form-id’ identifier option.

 

Related content

Additional settings
Additional settings
More like this
WordPress integration
WordPress integration
Read with this
Attaching forms
Attaching forms
More like this
DotCMS Integration
DotCMS Integration
More like this
Minimum website form
Minimum website form
More like this
JavaScript form submit listeners (technical)
JavaScript form submit listeners (technical)
More like this