Jump to content

Form Post Submit JavaScript suddenly stopped working

Go to solution Solved by paul2009,

Recommended Posts

Posted (edited)

Hi,

We've been measuring our form submissions through Google Tag Manager. We did this by adding an event in JS in the Post-submit HTML  like this:

<script>
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({'event':'leadform_submission'});
</script>

 

This method suddenly stopped working and can't find the reason.

It's not a GTM issue, I've tested a simple JS like this:

<script>
alert("thanks");
</script>

and it won't run either.

 

What could cause JS not to run in this section anymore?

 

Thanks

Edited by Mate
edited code for readability
Link to comment
  • Solution
Posted (edited)
9 minutes ago, Mate said:

What could cause JS not to run in [the Post-submit HTML] section anymore?

@Mate Squarespace just rolled out a new, international-friendly Form Block. It has replaced the old Form Block on all Squarespace 7.0 and 7.1 sites.

With this new Form Block, Post-submit HTML no longer supports scripts (the content in script tags is ignored). 

You can raise this with the Internationalization team as a feature request by raising a support ticket with Squarespace Customer Care

Did this help? Please give feedback by clicking an icon below  ⬇️

Edited by paul2009

About: SQSP User for 17 yrs. Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF Digital, building Squarespace Extensions to supercharge your commerce website. 
Content: Links in my posts may refer to SF Digital products or may be affiliate links.
If my advice helped, you can thank me by clicking one of the feedback emojis below. I love coffee too.

Link to comment

Thanks, Paul, that's a tremendous help, at least I know now where the problem is coming from!

Is there a new, recommended way to measure form submissions, or it is just not supported anymore and that's that?

Link to comment
Posted (edited)
On 5/12/2023 at 9:34 AM, Mate said:

Thanks, Paul, that's a tremendous help, at least I know now where the problem is coming from!

Is there a new, recommended way to measure form submissions, or it is just not supported anymore and that's that?

I am in the exact same boat, I thought I was going crazy for a little bit.

Did you figure out a solution to that? 

 

I am about to try putting it in the footer

.

Edit 

I ended up redirecting to a thank you page

Edited by Sharif
Link to comment
  • 2 weeks later...
  • 4 weeks later...

No solution yet, but I did confirm that the new international-friendly form block also breaks Zapier integrations if you are passing hidden fields.

It is possible to detect the events with an ajax listener, but that seems fragile and likely to break with a later deployment.

Seems like something they should have tested...

Edited by KenWilly
added note about ajax listener
Link to comment
  • 2 weeks later...

I (was) using it for passing user-provided data for enhanced conversions tracking in Google Ads, this is now broken as I had to revert to redirect and track a thank-you page. Squarespace should prioritize this and make an urgent hot fix in my opinion, it is a bit embarrassing.

Link to comment

Our form submissions have also been breaking.  We've lost many potential customers and now we have to redo our forms, and upgrade to "business" just to add web leads into Salesforce.   There was no warning of this change.   Squarespace customer support was also unable to give us direction on what had happened.

Link to comment
  • 2 months later...

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.