Summary
If you’d like to have a Hubspot form (on a landing page or web page) redirect visitors to a content track you can follow the instructions in this article.
This article covers:
- How to redirect form fills to a Content Track
Redirect Form Fills to a Content Track
- Create a form in Hubspot. This form will serve as the gate to your content track. Place this form on a landing page or web page using the embed code. Your embed will look something like this:
Example Hubspot Form Embed Code<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js">script> <script> hbspt.forms.create({ portalId: "4989506", formId: "7035c852-15f2-4f63-91b4-8811de8e75de" }); script>
- Add a comma after the formId line and then add the following line of code afterward:
onFormSubmitted: function($form) { window.location.href="PFTRACKURL&lb_email="+$form.find('input[name="email"]').val(); }
- Now your form embed code should look like this in full. Everything in red has been added to have the form correctly redirect to the content track:
Test Form Redirect
Note
|
Test to ensure this sequence of steps works as expected. |
- Render the Hubspot form created in Step 1 in your browser and fill it out.
- You should be redirected to your content track. Spend some time viewing the content in your track and thirty minutes after you close your session check back to PathFactory track analytics to see your session information assigned to an email.