SOLVED

Re: What is the impact of switching to a thank you message after a successful form submission instead of using a page refresh?

Go to solution
dkonig
Level 3

Re: What is the impact of switching to a thank you message after a successful form submission instead of using a page refresh?

Not sure if I should start a new thread or not but I am having issues with this code now that I have finally had a chance to test. When I add that push() instead of the form submitting and the confirmation message showing the page refreshes. Why would that be?

SanfordWhiteman
Level 10 - Community Moderator

Re: What is the impact of switching to a thank you message after a successful form submission instead of using a page refresh?

If your code throws an error in a success handler, the it reverts to default behavior. Presumably you don't have the dataLayer available.

dkonig
Level 3

Re: What is the impact of switching to a thank you message after a successful form submission instead of using a page refresh?

Hmm. Doesn't GTM create the dataLayer?

 

But I guess this is custom data so I would need to add in the following before the push() correct?

 

window.dataLayer = window.dataLayer || [];

 

dkonig
Level 3

Re: What is the impact of switching to a thank you message after a successful form submission instead of using a page refresh?

Didn't work 😥

SanfordWhiteman
Level 10 - Community Moderator

Re: What is the impact of switching to a thank you message after a successful form submission instead of using a page refresh?

What page is this on?
dkonig
Level 3

Re: What is the impact of switching to a thank you message after a successful form submission instead of using a page refresh?

Can I DM you the page?