Tracking Embedded Hubspot Forms

Main Setup Guide

This will only work with embedded Hubspot forms.

Optional Advanced Step – Optimizing Hubspot Form Tracking

Why is this necessary?

Although the above steps allow Hyros to track lead opt-ins made via Hubspot forms accurately most of the time, Hubspot forms can prove to be occasionally unreliable. This means in some instances our universal script can not track the lead opt in correctly.

This is generally rare, but if you want to optimize your tracking with Hubspot forms, please follow these steps.

Step 1 – Adjusting your embed code

You should have already adding the Hyros universal script following the standard video guide, however there is an extra piece of code we need to add manually for this purpose.

Please copy the code below:

onFormSubmit: function($form) {
      setTimeout(function() {
        var formData = $form.serialize();
        let redirectURL = "https://domain.thank-you";
        window.location = redirectURL + "?" + formData;
      }, 250); // Redirects to url with query string data from form fields after 250 milliseconds.
    },

Then paste it in your Hubspot embed form that you received from Hyros in the Main Setup guide, and ensure you have changed the URL on the code to the thank you page that you want to redirect leads to after submitting the form.

Enter your redirect URL here between the quotation marks

When you are ready, replace your. current live embedded Hubspot form with this new embed code.

Step 2 – Ensure the form does NOT redirect to another page upon submission

In the options for your Hubspot form, ensure you have the option to “display a thank you page” when the lead submits a form:

info

Why can I not select “redirect to another page?”

The extra code we added in the previous step already redirects the lead to another thank you page, so if you select “redirect to another page” here you will over-ride the code you added in the previous step, meaning the form details will not be passed on the URL of the next page.

Step 3 – run a test

Enter the details on the form as if you were a lead. You will be redirected to the page you entered manually on the code in step 1.

You should see the details entered from the form attached to the end of the URL you are redirected to.

For example if you are redirected to www.hyros.com, then the URL should read www.hyros.com?email=youremail@hyros.com

There may be other information included, but for tracking purposes the most important field is the email. If this is not included please ensure you have followed the steps above correctly.

Otherwise this concludes the setup.