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?
If your code throws an error in a success handler, the it reverts to default behavior. Presumably you don't have the dataLayer available.
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 || ;