Jump to content

How can I track form submissions in Google Analytics?

Go to solution Solved by foleyatwork,

Recommended Posts

If anyone comes across this, our team recently added support for Squarespace sites.

BigPicture.io (https://.bigpicture.io) is a point-and-click event tracking tool. We make it easy to setup tracking and integrate with hundreds of tools without having to write a line of code.

We have a ton of integrations including GA, Facebook, and ActiveCampaign.

Link to comment

Helllo Everyone,

i was very confused to make form with the effects then i concern with the very professional web developer that helps me as more as i need. Try to contact with them if you have any issues in your website


Link to comment
  • 3 months later...
  • 2 months later...
  • 2 years later...
  • 2 years later...
  • 5 months later...

Seems adding <script> tags in the "post submit HTML" of the form block is not working anymore in 7.1 🤨

...which is quite annoying!

Based on the idea of @foleyatwork I rewrote it to have it working on 7.1

Paste this code in the footer code injection of the whole website:

    document.addEventListener('DOMContentLoaded', function() {
        console.log('Squarespace ready');

        document.querySelectorAll('.form-block').forEach((formBlock) => {
            const jsonStr = formBlock.querySelector('script[id*=form-context]').textContent;
            const formName = JSON.parse(jsonStr).formName;

            formBlock.onsubmit = function() {                
                // Facebook Lead event example
                fbq("track", "Lead", {content_category: 'form', content_name: formName});
                // Google Lead event example
                gtag('event', 'generate_lead', {event_category:'form', event_label: formName});
    }, false);


Hope it helps.

Link to comment
  • 1 month later...


I hope you don't mind me reviving this old thread, as it's exactly what I'm looking for but these solutions aren't working - maybe the JS script in the footer, but ideally I'd like to:

- How can I track the form and button conversions I see in Squarespace analytics in my GA4?

I'd like to see when people subscribe to my email list.

The previous solutions seem to be for older versions of squarespace, google analytics and don't use Tag manager, which I was also trying to work out. Can I tag the event in GA4 Tag manager?

Thanks for your help!

My website is www.jominceramic.com

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.