Get Started Log in
Docs / HubSpot

HubSpot

Sourcream writes each lead's first and last source, medium and campaign (and on Business plans and above the extended values) into HubSpot contact properties, through HubSpot's API.

1. Connect

  1. In Sourcream, open Integrations and choose Connect on HubSpot.
  2. HubSpot asks you to pick an account and grant access. Use a HubSpot user who can install apps and edit contact properties (a super admin is simplest). Sourcream asks for these scopes: crm.objects.contacts.read, crm.objects.contacts.write, crm.schemas.contacts.read, crm.schemas.contacts.write and oauth.
  3. You return to Sourcream with the integration connected. Sourcream then runs Setup, which creates a property group called Sourcream and one single line text contact property per value. Properties that already exist are left alone, so Setup is safe to run again from the integration's card at any time.

How many integrations you can connect depends on your plan: one on Starter, three on Business, unlimited on Pro and Agency.

2. Properties

Sourcream value HubSpot internal name Label
first_source sourcream_first_source First source
first_medium sourcream_first_medium First medium
first_campaign sourcream_first_campaign First campaign
last_source sourcream_last_source Last source
last_medium sourcream_last_medium Last medium
last_campaign sourcream_last_campaign Last campaign
sc_visitor_id sourcream_visitor_id Sourcream visitor ID
first_term sourcream_first_term First term
first_content sourcream_first_content First content
first_channel sourcream_first_channel First channel
first_landing_page sourcream_first_landing_page First landing page
first_referrer sourcream_first_referrer First referrer
first_timestamp sourcream_first_timestamp First touch time
last_term sourcream_last_term Last term
last_content sourcream_last_content Last content
last_channel sourcream_last_channel Last channel
last_landing_page sourcream_last_landing_page Last landing page
last_referrer sourcream_last_referrer Last referrer
last_timestamp sourcream_last_timestamp Last touch time
gclid sourcream_gclid Google click ID
gbraid sourcream_gbraid Google gbraid
wbraid sourcream_wbraid Google wbraid
msclkid sourcream_msclkid Microsoft click ID
fbclid sourcream_fbclid Meta click ID
ttclid sourcream_ttclid TikTok click ID
li_fat_id sourcream_li_fat_id LinkedIn click ID
touch_count sourcream_touch_count Touch count

The first seven are the core set, sent on every plan. The rest are sent when the integration's Field set is Extended (Business plan and above). On Pro and Agency you can point any value at a different property with the integration's Field mapping, for example an existing original_source_campaign property you already report on.

Write rules:

  • First touch values are only written when the property is empty, so a contact's original source is never replaced by a later lead. Turn on Overwrite first touch to change that.
  • Last touch values, click ids and the visitor ID are written with every lead.

3. Matching contacts

Choose under the integration's settings:

  • Match by email (default). Sourcream searches contacts by the lead's email and updates the match. With Create when missing on, it creates the contact (email, first name, last name, phone, company) when there is none. Needs the site's Capture mode set to Email, or a webhook or API lead that carries an email.
  • Match by visitor ID. Sourcream finds the contact whose sourcream_visitor_id equals the lead's visitor ID. No personal information leaves the visitor's browser for Sourcream, but your form must put sc_visitor_id into that property (see below). When no contact has the ID yet, Sourcream retries every 5 minutes for up to 24 hours, then marks the delivery failed with "No CRM record with this visitor ID".

If your forms are HubSpot forms and you match by email, keep Create when missing on. Sourcream's delivery can arrive a few seconds before HubSpot finishes processing the form submission; HubSpot deduplicates contacts by email, so both end up on the same contact.

4. HubSpot forms on your site

Embedded HubSpot forms work with the Sourcream script:

  • Lead capture: HubSpot's standard embed code reports each submission (its onFormSubmitted callback). Sourcream picks that up and records the lead with the submitted email, then delivers it as above.
  • Hidden properties in the form (optional): add the Sourcream properties to the HubSpot form as hidden fields, then in Sourcream set the site's Field names to the HubSpot names (first_source to sourcream_first_source, ..., sc_visitor_id to sourcream_visitor_id). The script fills them, and HubSpot stores the values with the submission itself. This is what makes Match by visitor ID possible with HubSpot forms. It only works when the form renders on your page; a form inside an iframe cannot be filled by any script on your page, so use email matching for those.

Submit a test with UTMs on the URL and check the contact's Sourcream properties in HubSpot and the delivery under Integrations in Sourcream.

5. Test

The integration's Send test lead button writes a synthetic lead to HubSpot: contact [email protected], name "Sourcream Test", first touch google / cpc / test, last touch facebook / cpc / test. Delete that contact afterwards. The Deliveries log shows every delivery, its status and any error, with a retry button for admins.

6. Reporting in HubSpot

The properties are ordinary contact properties: filter lists, build reports ("Contacts by First source"), and copy them to deals with a workflow if you report on deals.

Disconnecting

Remove the integration in Sourcream to stop deliveries; Sourcream revokes its token. The properties and their values stay in HubSpot. To remove the app completely, also uninstall it under HubSpot's connected apps settings.

Questions: [email protected]

Stuck on an install? Email [email protected] with your site address and what you are seeing, and we will help you get it working.