HubSpot is a leading marketing and sales platform that helps you track leads as well as inbound marketing and sales.

RudderStack supports HubSpot as a destination where you can seamlessly send your event data.

Find the open source transformer code for this destination in the GitHub repository.

Getting started

Before configuring HubSpot as a destination in RudderStack, verify if the source platform is supported by HubSpot by referring to the table below:

Connection ModeWebMobileServer
Device modeSupported--
Cloud modeSupportedSupportedSupported
To know more about the difference between cloud mode and device mode in RudderStack, refer to the RudderStack Connection Modes guide.

Once you have confirmed that the source platform supports sending events to HubSpot, follow these steps:

  1. From your RudderStack dashboard, add the source. Then, from the list of destinations, select HubSpot.
  2. Assign a name to the destination and click on Continue.

Connection settings

To successfully configure HubSpot as a destination, you'll need to configure the following settings:

HubSpot connection settings
  • Hub ID: Enter your HubSpot Hub ID. For more information on obtaining the Hub ID, refer to the HubSpot support guide.
  • API Key: Enter your HubSpot API key. For more information on obtaining the API key, refer to the HubSpot support guide.
The HubSpot API Key is mandatory for sending the data to Hubspot via the RudderStack cloud mode.

Client-side events filtering

This option is applicable only if you're sending events to HubSpot via the web device mode. Refer to the Client-side Event Filtering guide for more information on this feature.

Web SDK settings

HubSpot web SDK settings
  • Use device mode to send events: Enable this setting to send events via the device mode.
You can change the setting to enable or disable device mode to send events at any point. However, note that you will need to refresh your web page for the changes to reflect.

Page

The page call lets you record your website's page views with any additional relevant information about the viewed page.

RudderStack does not support sending the page calls to HubSpot via the cloud mode.
To send the data to HubSpot, an initial page call is required. For more information on the page call, refer to our RudderStack Events Specification documentation.

Identify

RudderStack sends the identify call to create or update a contact in HubSpot. The user's email ID must be present in the identify call's traits.

In the cloud mode, the identify call will create or update a contact in HubSpot. You are not required to call page or track later in order to create the contact.
In the device mode, you must call either page or track after the identify call to create a contact. The previously made page and track calls will automatically be associated with that contact once they are identified.

A sample identify call is as shown:

rudderanalytics.identify({
firstName: "Tintin",
city: "Brussels",
country: "Belgium",
phone: "1234567890",
email: "tintin@twentiethcentury.com",
custom_flavor: "chocolate",
custom_date: 1574769933368,
custom_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

RudderStack supports sending custom properties to HubSpot via the identify call. These properties will update the contact property you have already created in HubSpot, as shown:

HubSpot create property
Refer to the HubSpot Knowledge Base for more information on creating custom properties.

When you provide any custom property in the event, RudderStack automatically converts the field name into the lower case and replaces any space with an underscore. This is because HubSpot does not accept properties in the upper case and spaces.

RudderStack then maps the field values present in the traits to the corresponding HubSpot custom property.

HubSpot discards any property that does not exist and returns a 400 Bad Request error.

Dates

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

Track

A track call lets you record various user actions and any properties associated with them.

To associate a track call with a user, you need to specify the user's email under context.traits . Additionally, RudderStack associates the track events with the same user after an identify request is successfully made.

A sample track event is as shown:

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

Revenue events

For the revenue events, a value or revenue key should be included in the event properties to be recorded in HubSpot.

Screen

The screen call lets you record whenever your user views their mobile screen, with any additional information about the viewed screen.

If you have enabled screen views in your Android or iOS app implementation, RudderStack will send this information to HubSpot.

RudderStack also forwards the properties you've passed along with the screen call without any changes.

A sample screen call sent via the iOS SDK is shown below:

[[RSClient sharedInstance] screen:@"Main"
properties:@{@"prop_key" : @"prop_value"}];

HubSpot custom objects

RudderStack supports sending the HubSpot CRM custom object via the identify call. It expects an object named hubspot with the following properties:

  • contactId
  • qualifiedName
  • objects

objects should be an array containing the objects with two properties - objectId and objectType. Also, contactId is the ID of your HubSpot contact. RudderStack associates the contact with the objects you provide in the objects array.

A sample identify call for HubSpot CRM custom object is shown below:

rudderanalytics.identify("userId", {
email: "name@domain.com",
hubspot: {
contactId: "512",
qualifiedName: "p99688696_car",
objects: [{
objectId: "32921360",
objectType: "car",
}, ],
},
})

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.

Refer to the following HubSpot guides for more details:

Can I use Hubspot website analytics?

Yes - RudderStack supports sending page calls in device mode which can be used for Hubspot website analytics.

Contact us

For queries on any of the sections covered in this guide, you can contact us or start a conversation in our Slack community.