Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shawncrigger/5d56875e3d1b8a86f0842e03b1885273 to your computer and use it in GitHub Desktop.
Save shawncrigger/5d56875e3d1b8a86f0842e03b1885273 to your computer and use it in GitHub Desktop.
Submit SquareSpace forms to Sharpspring CRM

Sending Form Data to Sharpspring from a SquareSpace website.

Recently a new client has a SquareSpace website and they want to use Sharpspring for there CRM which I am all for. But one of the challenges I found was that the SquareSpace forms offered very little customization , so I hacked together some JavaScript that sends the form data to Sharpspring then continues with the Rest of the SquareSpace submit handler.

I'm sure there is probably a better way to do this but this way worked for me and the client is happy so, that's all I can say.

So the idea behind this, is you can built a Native Sharpspring form and make sure all the fields that you have on your form on your website exist, Once you have the Sharpspring form built, click on the button to preview it, and you will need to inspect the form source code, where you will find things like the CompanyID, FormID, and FieldIDs they are all very easy to grab using the web inspector, if anyone has issues doing this just comment on this thread and I'll make a short guide on how to get that information.

So now onto the SquareSpace part of things, basically the theory is this, I find the SquareSpace form tag , and grab the onsubmit event, Now I add a function call I wrote to handle the Sharpspring stuff in front of the rest of the onsubmit event and then replace the onsubmit event with the new one.

The trick is finding a way to ID the form since the ID is never the same and there might be more then one form etc, I just found a class that is unique to the page above the form and did it like that.

Now after logging into the Admin Area of SquareSpace, you will want to goto "Settings > Advanced > Code Injection" and include the file you modified earlier into the Footer area of the Code Injection

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment