APIs & Integrations

TDearlove6
Member

Rudderstack and HubSpot

SOLVE

Hi All, long shot. We are trying to replace our current forms with a HubSpot form, but the blocking issue is we need to create a Rudderstack track event that fires upon from submisssion. Has anyone done this before? While HubSpot is a Source in Rudderstack, it only allows you to send data to a data warehouse. 

0 Upvotes
1 Accepted solution
Anton
Solution
Thought Leader

Rudderstack and HubSpot

SOLVE

Hi @TDearlove6

if you're embedding the HubSpot forms on a "non-HubSpot-page" you can modify the form-embed code with a onFormSubmit action and trigger the Rudderstack tracking event. 

 

Here's a quick example:

 

The default form-embed code looks like this

<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/embed/v2.js"></script>
<script>
  hbspt.forms.create({
    region: "na1",
    portalId: "XXX",
    formId: "XXXXXX-XXXXXX-XXXXXXXX"
  });
</script>

 

with a onFormSubmit addition it would look like this

<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/embed/v2.js"></script>
<script>
  hbspt.forms.create({
    region: "na1",
    portalId: "XXX",
    formId: "XXXXXX-XXXXXX-XXXXXXXX",
    onFormSubmit:{
       //your Rudderstack tracking action
    }
  });
</script>

 

 

hope that helps,

 

best, 

Anton

Anton Bujanowski Signature

View solution in original post

0 Upvotes
1 Reply 1
Anton
Solution
Thought Leader

Rudderstack and HubSpot

SOLVE

Hi @TDearlove6

if you're embedding the HubSpot forms on a "non-HubSpot-page" you can modify the form-embed code with a onFormSubmit action and trigger the Rudderstack tracking event. 

 

Here's a quick example:

 

The default form-embed code looks like this

<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/embed/v2.js"></script>
<script>
  hbspt.forms.create({
    region: "na1",
    portalId: "XXX",
    formId: "XXXXXX-XXXXXX-XXXXXXXX"
  });
</script>

 

with a onFormSubmit addition it would look like this

<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/embed/v2.js"></script>
<script>
  hbspt.forms.create({
    region: "na1",
    portalId: "XXX",
    formId: "XXXXXX-XXXXXX-XXXXXXXX",
    onFormSubmit:{
       //your Rudderstack tracking action
    }
  });
</script>

 

 

hope that helps,

 

best, 

Anton

Anton Bujanowski Signature
0 Upvotes