HubSpot

Step-by-step guide to send event data from RudderStack to HubSpot

HubSpot is a leading marketing and sales platform that helps you track leads, as well as inbound marketing and sales. It offers state-of-the-art tools for efficient marketing, tracking sales and offering better customer support.

RudderStack supports HubSpot as a destination to send your event data through our APIs.

Getting Started

Before configuring your source and destination in RudderStack, please check whether the platform you are working on is supported by HubSpot. Refer the table below:

Connection Mode

Web

Mobile

Server

Device Mode

Supported

-

-

Cloud Mode

Supported

Supported

Supported

Once you have confirmed that the platform supports sending events to HubSpot, perform the steps below:

Please follow our Adding a Source and Destination guide to add a source and destination in RudderStack.

  • Give a name to the destination and click on Next. You should then see the following screen:

Connection Settings for HubSpot in RudderStack
  • Provide your HubSpot API key and Hub ID in the required fields. Please find API Key and Hub ID in your Hubspot Account.

  • Provide your preference to flow the data to HubSpot through native SDK or through the RudderStack backend. Click on Next to finish the configuration.

The setting to enable / disable native SDK to send events can be changed later. However, for that to reflect in your website, you will need to refresh the web page.

Page

To send the data to HubSpot, an initial page call is required. For more information on the page call, please refer to our RudderStack API specification documentation.

For HubSpot, we support the page call only in our JavaScript SDK.

The following snippet is an example of a page call:

rudderanalytics.page();

Identify

The identify call is used to create or update a contact in HubSpot. To send data through our JavaScript SDK, you need to call either page or track after that.

You need to provide an email id of that user under the traits of the identify call.

If you want to send the data through our RudderStack backend, you don't need the additional page or track call to create or update a contact in HubSpot.

Here is an example identify call:

rudderanalytics.identify(
{
firstname: "Tintin",
city: "Brussels",
country: "Belgium",
phone: "1234567890",
email: "tintin@twentiethcentury.com",
Test_prop: "abcdef",
test_date: 1574769933368,
test_date1: new Date("2019-10-14T11:15:53.296Z")
}
)

Special fields

HubSpot supports the following traits as special fields:

  • address

  • city

  • companyName

  • email

  • firstName

  • lastName

  • position

  • phone

  • zip

Custom properties

Hubspot also supports custom properties. You can update values of the contact property that you have created in HubSpot.

  • Please note that when you provide any custom property, it will automatically be converted to lower case and any space will be replaced with an underscore. HubSpot does not accept properties in upper case and spaces.

  • Any non-existing property will be discarded from the payload, as HubSpot returns a 400 Bad Request for non-existing properties.

For sending properties of type date send the date as the epoch time, or as a date object. We will convert it to the required HubSpot format (midnight UTC).

Track

A track call is used to record any action the user performs. For more information on the track call, please refer to our RudderStack API specification documentation.

To associate a track call with a user, you need to specify the user's email under traits under context . Also, if any track call is made after an identify call, it will be associated with that contact.

HubSpot allows you to track the revenue associated with a user. So, if you provide revenue or value property under properties in track, HubSpot will track it as a revenue associated with that user.

The following code snippet shows a sample track call made to HubSpot:

rudderanalytics.track(
"Purchase",
{
value: 30
},
{
context: {
ip: "0.0.0.0",
traits: {
firstname: "Tintin",
city: "Brussels",
country: "Belgium",
phone: "1234567890",
email: "tintin@twentiethcentury.com"
}
},
anonymousId: "00000000000000000000000000"
}
);

You can update your contacts using a track call as well. As shown in the above example, if you provide the relevant contact information in traits under contextwith the email mentioned as well, HubSpot will create or update that contact.

FAQs

Where do I get the API Key and Hub ID for Hubspot?

You can get the API Key and Hub ID for Hubspot by logging into your Hubspot account.

Please refer to the following documentations offered by Hubspot for more details:

Contact Us

If you come across any issues while configuring HubSpot with RudderStack, please feel free to contact us or start a conversation on our Discord channel. We will be happy to help you.