1. Home
  2. Forms
  3. Hubspot Forms
  4. Using a Content Track as a Hubspot Form Confirmation Page

Using a Content Track as a Hubspot Form Confirmation Page

Summary

Your Hubspot form on a native HubSpot landing page or any webpage can redirect visitors to a content experience and de-anonymize them for PathFactory engagement reporting that can eventually be shared with Hubspot through the webhook integration.

This article covers:

  • How to redirect HubSpot form fills to a Content Experience.

Scenario:

  • You have a Hubspot Form on a native HubSpot landing page or on any webpage.
  • You want to send visitors who fill out the form to a PathFactory Content Experience rather than a static Thank You page.
  • You want those visitor engagement activities to be tracked and the data to be sent back to Hubspot through the existing PathFactory-HubSpot integration.

Redirect Form Fills to a Content Experience

Create a new form in HubSpot or use an existing one to serve as the gateway to your PathFactory content experience. 

For HubSpot Landing Page:

  1. Add this form to a HubSpot landing page using the landing page builder within HubSpot and paste the code below to the Head HTML section under Settings > Advanced. 

    HubSpot Landing Page
    HubSpot Landing Page

For any other webpages:

You can embed this form on any webpage by using the provided embed code from HubSpot and all you have to do is paste the below code to the <head> section of the page and publish it.

Code Snippet:

<script>

    window.addEventListener('message', function (event) {

        if (event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormSubmitted') {

            var submissionValues = event.data.data.submissionValues || {};

            var email = submissionValues.email;

            if (email) {

                var gotoStr = "YOUR_EXPERIENCE_URL_GOES_HERE";

                top.location.href = gotoStr + (gotoStr.indexOf("?") > -1 ? "&" : "?") + "lb_email=" + email;


 }
            return false;

        }

    });

</script>

Notes:

  • Make sure to update the placeholder text YOUR_EXPERIENCE_URL_GOES_HERE with the URL of your content experience.
  • This code snippet is Tag Manager friendly (GTM, Adobe Launch etc) so you may choose to fire it through one of these.
  • When using this code on a Hubspot landing page make sure the page only has a single HubSpot form. Any additional forms on the landing page may cause the script to fail to execute.
  • Make sure you have set the option ‘What should happen after someone submits this form?’ to ‘Thanks You Message’ on both the form and HubSpot landing page level.

Test Form Redirect

  1. Render the Hubspot form within the landing page or webpage and fill it out.
  2. You should be redirected to the PathFactory content experience. Spend some time viewing the content in your experience and after you close your session check back to PathFactory experience analytics after a couple of hours to see your session information assigned to an email.

Example

I filled out a Hubspot form that redirected me to my Test123SLR content experience and spent some time viewing a few assets. I can see my engagement data in PathFactory assigned to the email I used in my Hubspot form submission (sreelal.reghunathan@pathfactory.com).

Engagement data for this session also appears in Hubspot on the contact record of the visitor. You should see this data in the custom contact properties for the visitor that filled out the form.


<script>

    window.addEventListener('message', function (event) {

        if (event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormSubmitted') {

            var submissionValues = event.data.data.submissionValues || {};

            var email = submissionValues.email;

            if (email) {

                var gotoStr = "YOUR_EXPERIENCE_URL_GOES_HERE";

                top.location.href = gotoStr + (gotoStr.indexOf("?") > -1 ? "&" : "?") + "lb_email=" + email;


 }
            return false;

        }

    });

</script>

Engagement Data

Views: 29

Updated on September 23, 2024

Was this article helpful?

Need Support?
Can't find the answer you're looking for? Don't worry we're here to help!
CONTACT SUPPORT