This is an alternative method to track forms more effectively without using thank-you pages. It is particularly useful for tracking gravity forms that redirect upon submission, simplifying the tracking process and reducing the risk of incorrect data.
While we have a reliable tracking method for forms that do not redirect, I am trialing a new method for those that do. According to Gravity Forms documentation, the jQuery hook gform_post_render() is fired every time the form is rendered. This includes initial form load, navigating between pages in multi-page forms, rendering with validation errors, and displaying confirmation messages.
We leverage the gform_post_render event without the current_page value to identify a successful form submission. This approach also facilitates tracking multi-page forms, as an integer value for current_page is sent along with the event to indicate the completed page or step.
I have tested this method on several sites, and it works well, but I have not yet officially implemented it on any site.
<script type="text/javascript">jQuery(document).on('gform_post_render', function(event, form_id, current_page){window.dataLayer = window.dataLayer || [];// Push the event details to the data layerdataLayer.push({event: 'gform_post_render',formId: form_id,currentPage: current_page});});</script>