Have you ever felt exhausted loading data from your customer data platforms to your CRMs manually? This can be hectic at times. In order to overcome this, you can integrate your customer data platform Segment with your cloud-based CRM HubSpot and make your work easier. With Segment HubSpot integration, you can keep all your customer data in your HubSpot instance up to date automatically.

In this blog, you will be introduced to Segment and HubSpot. The steps involved in their Segment HubSpot integration will be discussed in depth. You will also learn the method to use HubSpot with Personas here.

Introduction to SegmentSegment is one of the leading customer data platforms. Segment collects customers’ touchpoints across different platforms, unifies them, and provides a complete data toolkit to all the teams in your organization. The first part n the Segment platform generates messages about happenings in the site or app and sends them to the Segment servers. Segment translates the content of those messages into different formats and sends the translated message to the other destination tools. There are several tracking API methods in Segment that generates messages.

The four most important API methods are:
Page and Screen – what web page or screen the user is using?
Identify – who is the user?
Track – what the user is using?

Introduction to HubSpot

HubSpot is a marketing automation platform. HubSpot is a complete marketing suite that includes everything from tools for email and SEO, a repository for managing leads generated from the campaign to tools to track social media engagement metrics with an additional schedule for response and outgoing posts. Its products and services aim to provide tools for CRM, social media marketing, content management, lead generation, web analytics, SEO, live chat, and customer support.HubSpot is usually integrated with another source of truth, like Salesforce, since HubSpot default contacts have different lifecycle stages than a typical CRM setup.

HubSpot consists of different hubs like,
Marketing Hub– This Hub helps you to increase traffic, convert leads and run complete inbound marketing campaigns at scale.
Sales Hub– This Hub allows you to dig deeper into prospects to get more insights and automate tasks.
Service Hub– Using this Hub you can connect with customers.
CMS Hub– Content Management Software gives you a secure experience.
Operations Hub– Operations software automates the processes of syncing and cleaning customer data.

Working of HubSpot

To sync prospects and leads into HubSpot, you must integrate it with your existing source of truth or you must upload the CSV  file manually. When the HubSpot form is deployed for your gated content, new leads entering your system will be automatically captured in HubSpot. The schema of HubSpot centers on contacts with different lifecycle stages. For example, if Salesforce is your source of truth, you would map in leads that become contacts in HubSpot. This happens in phase 0 or 1 of the lifecycle.HubSpot lifecycle also includes lead, SQL, Opp, MQLCustomer Evangelist, and subscriber.

Introduction to Segment HubSpot Integration

You can get more insights out of HubSpot with Segment. When Segment HubSpot integration is done, your way of capturing contacts can be altered. You need not completely look for lead forms or upload your lists. With Segment HubSpot integration,

all the customer data in your HubSpot instance is up to date automatically by Segment. After Segment HubSpot integration, you can even include the lifecycle stage as a user trait and Segment will move contacts through lifecycle stages automatically. Segment HubSpot integration saves your time, you need not integrate different sources of truth into the system. Since you can just turn on HubSpot from your Segment dashboard without any code. Segment HubSpot integration helps you in keeping all customer data records synced and up-to-date across systems in real-time.

Steps in Segment HubSpot integration

In Segment HubSpot integration, HubSpot accepts all the four method calls i.e. Page, Group, Identity, and Track calls from Segment.

Pre-requisites

HubSpot is available in device-mode for Analytics.js only which is open-source. You can browse the code on GitHub.Page calls are supported only from Device-mode connections only. But HubSpot also has cloud mode for Mobile and Server sources also. Before starting the Segment HubSpot integration, make sure that the HubSpot support type and connection mode that you have chosen to implement. Check this detailed guide to know more about Connection Modes.

Steps

  1. From the Segment web app, click Catalog.
  2. Search for “HubSpot” in the Catalog, select it, and choose which of your sources to connect the destination.
  3. If you haven’t already done so, add your API Key from HubSpot and enter it in the “API Key” field in the Segment web app.
  4. Navigate to the “Settings” page in the HubSpot UI to find your Hub ID and enter it to the “Hub ID” field in the Segment web app.
Segment HubSpot Integration: Segment Catalog
Image Source: Segment

When you activate the destination from the Segment web app, after 45 minutes, your changes will appear in the Segment CDN. After this, Analytics.js starts asynchronously loading the HubSpot snippet and recording data.

It is necessary to also initiate few calls to send data to HubSpot.

Page

Analytics.js requires an initial Page Call to send data to HubSpot.The Segment snippet includes this initial call by default.HubSpot supports Page calls on device-mode connections from Analytics.js sources.

analytics.page()

Identify

To create or update a contact, HubSpot’s device-mode integration has two conditions to satisfy. Identify calls must include a “traits.email” value and need to accompany a Page or Track call. 

analytics.identify('user1234', {
  email: 'petergibbon@email.com',
  firstname: 'Peter',
  lastname: 'Gibbon'
})

HubSpot does not accept upper cases letters or spaces in trait keys. So Segment converts the custom trait to lower case and replaces the spaces with an underscore. Any traits that aren’t contact fields in HubSpot are removed from the request.

Track

You must have a HubSpot Enterprise account for traits from an Identify call to be passed through to your Track call and be successfully sent as a custom event to HubSpot.An example track call would look like this:

analytics.track("Clicked Buy Now button", {
  value: 20.5
})

The event will appear in your HubSpot and will get a graph for visualization only after 60 minutes.

Server

When you call any server-side sources, you must provide the contact’s email as properties.email for the HubSpot to tie the event to the appropriate contact. The example python call looks like this:

analytics.track(
  user_id='YOUR_USER_ID',
  event='Bought Item',
  properties={
    'email' : 'peter@example.com',
  }
)

Setting Contact Properties on Track

Though you send traits using Identify, you can also set HubSpot properties on a track call, as allowed by events API. This method can be used when you are running out of API calls on the Identify requests. Include HubSpot contact properties into the context.traits object:

analytics.track(
  user_id='YOUR_USER_ID',
  event='Bought Item',
  properties={
    'email': 'peter@example.com',
  },
  context={
    'traits': {
    'firstname': 'Peter',
    'lastname': 'Gibbons'
  }
})

Loading forms SDK

Segment provides you an option to load the HubSpot Forms SDK alongside their tracking library. This is done by enabling the Load Form SDK setting when configuring your Segment HubSpot integration. The Forms SDK expects to be loaded synchronously but analytics.js is loaded asynchronously. In order to interact, you need to run your code inside an “analytics.ready” callback. Here is an example:

analytics.ready(function(){
  hbspt.forms.create({
    portalId: '',
    formId: '',
    css: '',
    cssRequired: ''
  });
})

Using HubSpot with Personas

The computed traits and audiences that you create in Personas can be sent to HubSpot. This is done so that you can use the data in live chat, automated emails, and other HubSpot features to personalize interactions with your customers. You can set a lookback window for both computed traits and audiences, which limits the period of time in which data is considered when calculating the trait or audience.

Creating Personas Audiences in HubSpot

Steps to create Personas Audiences in HubSpot

Step1: Create your audience criteria and preview the audience in Segment. Then click select ‘Destinations’.

Segment HubSpot Integration:Configure
Image Source: Segment

Step2: Select HubSpot as a destination for the audience in Segment. Use the default settings given here.

Segment HubSpot Integration: Connection settings
Image Source: Segment

Step3: Enter a name for the audience along with a description. Write down the Audience key, but don’t click Create Audience yet.

Segment HubSpot Integration: Review & create
Image Source: Segment

Step4: Go to HubSpot Settings. Create a new property in HubSpot for each audience you want HubSpot to receive from Personas. You must do this before you send any Personas data from Segment to HubSpot because the HubSpot’s schema is explicitly defined.

Segment HubSpot Integration: settings
Image Source: Segment

Step5: Now set the object type. For user-level audiences, set Object Type to Contact and Group to Contact information. For account-level audiences, set object type to Company and the Group to Company information.

Step6: Enter the label for the custom property. You need to be careful here that this custom property should match the Audience Key you wrote down earlier from the Personas audience builder. Note that the audience label’s “internal name” in HubSpot must exactly match the Segment’s Audience Key. You can check this by clicking </> icon. Now click Next.

Segment HubSpot Integration: settings
Image Source: Segment

Step7: On the next screen, set the Field type for audiences to “Single checkbox”.Click Create to finish adding the audience contact property.

Segment HubSpot Integration :property
Image Source: Segment

Step8: Back in the Personas Audience builder, click Create Audience. Personas sends any users that meet the audience criteria to HubSpot immediately.

Verify the audience

The calls sent to HubSpot can be seen using the debugger in your Personas space. Edit the URL below to replace YOUR_WORKSPACE and YOUR_PERSONAS_SPACE with the workspace and personas space you’re working in.

https://app.segment.com/YOUR_WORKSPACE/sources/YOUR_PERSONAS_SPACE/debugger

Segment HubSpot Integration: verify audience
Image Source: Segment

You can check back in HubSpot to see the audience boolean as a contact property. For the audience created in the example above, you could check individual contact profiles and see a contact property called “Email Opened 30 Days =Yes”

Segment HubSpot Integration: manage properties
Image Source: Segment

You can also see this in the contact property history for each user record.

Segment HubSpot Integration: properties history
Image Source: Segment

Conclusion

In this article, you have learned about the steps involved in setting up Segment HubSpot Integration. This blog also provides information about Segment, HubSpot and its working, & benefits of setting up Segment HubSpot Integration.

Hevo Data, a No-code Data Pipeline provides you with a consistent and reliable solution to manage data transfer between a variety of sources such as HubSpot and Segment, and a wide variety of Desired Destinations with a few clicks.

Visit our Website to Explore Hevo

Hevo Data with its strong integration with 150+ sources (including 30+ free sources) like HubSpot(free) and Segment(free) allows you to not only export data from your desired data sources & load it to the destination of your choice, but also transform & enrich your data to make it analysis-ready so that you can focus on your key business needs and perform insightful analysis using BI tools. 

segment_hubspot_integrationSign Up for a 14-day free trial and experience the feature-rich Hevo suite first hand. You may also have a look at the amazing price, which will assist you in selecting the best plan for your requirements.

Share your experience of understanding Segment HubSpot Integration in the comment section below!

mm
Business Analyst, Hevo Data

Sherley is a data analyst with a keen interest towards data analysis and architecture, having a flair for writing technical content. He has experience writing articles on various topics related to data integration and infrastructure.

No-code Data Pipeline for HubSpot and Segment