HubSpot

The ReferralHero/HubSpot integration is a robust solution offering several powerful functionalities:

  • Import existing contacts from HubSpot to ReferralHero

  • Automatically Add NEW HubSpot contacts to ReferralHero

  • Sync ReferralHero subscribers to your HubSpot account

  • Use your own HubSpot form to add new HubSpot contacts to your ReferralHero campaign

  • Trigger a ReferralHero conversion event when there is a lifecycle or deal stage update on HubSpot

Import HubSpot contacts to ReferralHero

If you have existing contacts in your HubSpot account and you want to import/subscribe them all to your ReferralHero campaign, you'll want to follow these instructions:

  1. Go to your Campaign Dashboard > Subscribers > Import and click on the tab Import from CRM.

  2. If you haven't connected your HubSpot account yet, please do it now by clicking on the button Setup Integration.

  3. Choose the HubSpot account from which you want to import contacts/subscribers.

  4. Specify a URL for the referral link. This is the URL that we will use to generate the referral link for your subscribers. For example, if you use http://mywebsite.com, the referral link will be 'http://mywebsite.com?mwr=123456'

  5. Optional: Choose to "Send Welcome Email" at the time of import. Note, you must activate your Welcome Email in Automations before enabling the "Send Welcome Email".

  6. Click on the button Import

We will import your subscribers into your ReferralHero campaign immediately. Depending on how many subscribers you are importing, it might take from a few minutes to several hours. We will send you an email when the import is finished.

NOTE: If you turn on the HubSpot integration (see the section below), ReferralHero will populate the custom fields in your HubSpot account with the subscriber's values.

Add New Hubspot Contacts to ReferralHero

ReferralHero's HubSpot Contact Created event is a proprietary algorithm that accurately tracks and identifies people as organic subscribers or referrals and adds them to your ReferralHero campaign when a new contact is created in your Hubspot account.

  1. In ReferralHero, navigate to Edit Campaign > Integrations > HubSpot, and click the "Connect your HubSpot account" button.

  1. Choose the HubSpot account you want to connect to ReferralHero

  2. Choose the HubSpot contact list from the HubSpot Domain dropdown

  1. Click Save

  2. The "Hubspot Contact Created" event is automatically created upon account connection.

If the event is not created in your account, manually create the "Hubspot Contact Created" event.

  1. Utilize the "Add Event to Track" button within the HubSpot integration page. Choose the “Create Contact” event type.

  1. Decide if you want to add organic subscribers and/or referrals only when a new HubSpot Contact Created event occurs.

The integration will automatically create the following custom fields in your HubSpot account.

CODE

Subscriber's unique referral code

EX_FIELD

Subscriber's extra field value

EX_FIELD_2

Subscriber's second extra field value

LAST_REF

Timestamp of last referral

POINTS

Subscriber’s total accumulated points

POSITION

Subscriber’s position

REF_LINK

Subscriber's unique referral link

REFERRER

Subscriber’s referrer’s name

SOURCE

Subscriber's source. If empty value will be "None"

SUB_ID

Subscriber's id

TOT_REF

Subscriber's total number of referrals

EM_LINK

Subscriber’s email link

FB_LINK

Subscriber’s Facebook link

TW_LINK

Subscriber’s Twitter link

MWR

Subscriber’s referrer’s referral code

Now when a person signs up for your ReferralHero campaign, they will be immediately added to your HubSpot account.

NOTE: ReferralHero will automatically update these custom fields when a person signs up or when things change (eg: when a subscriber refers a new person, their TOT_REF value changes).

How to Use Your Own HubSpot Signup Form

Generally, it is recommended to use our Contact Created event (explained above) however if you want to specifically track individual HubSpot forms or if you have a high volume form (100+ new contacts per day) you can track form submissions to ReferralHero by incorporating the ReferralHero JavaScript into your HubSpot form.

Add ReferralHero JavaScript to Your HubSpot Form

  1. Add one of the following JavaScript codes to the end of your HubSpot HTML form code. This code will seamlessly track new signups from your HubSpot form to your ReferralHero campaign.

NOTE: You need to replace the hubspot_form_id with your own HubSpot form ID.

Use RH.form.submit() to add both organic and track referrals to the referral campaign

window.RHConfig = {
    callbacks: {
      ready: function() {
        setTimeout(function(){
          var form = document.getElementById('hs-form-iframe-0').contentWindow.document.getElementById('hubspot_form_id');
          form.addEventListener("submit", function(e){
            var data = {
              email: form.querySelector('#email-hubspot_form_id').value,
              name: form.querySelector('#firstname-hubspot_form_id').value + ' ' + form.querySelector('#lastname-hubspot_form_id').value
            };
            if (RH) {
              RH.form.submit(data);
            }
          });
        }, 2000);
      }
    }
  }

Use RH.pendingReferral() to track only referrals with ‘Pending’ status to the multi-step conversion event campaign

window.RHConfig = {
    callbacks: {
      ready: function() {
        setTimeout(function(){
          var form = document.getElementById('hs-form-iframe-0').contentWindow.document.getElementById('hubspot_form_id');
          form.addEventListener("submit", function(e){
            var data = {
              email: form.querySelector('#email-hubspot_form_id').value,
              name: form.querySelector('#firstname-hubspot_form_id').value + ' ' + form.querySelector('#lastname-hubspot_form_id').value
            };
            if (RH) {
              RH.pendingReferral(data);
            }
          });
        }, 2000);
      }
    }
  }

2. (Optional)

To send other values from the HubSpot form to your ReferralHero campaign add this to the data line:

referral_hero_field_name: form.querySelector(’#HUBSPOT_FIELD_NAME').value

For example to send submitted data to the ReferralHero Extra Field profile field add:

extra_field: form.querySelector('#extra_field-hubspot_form_id').value

3. Now when someone signs up through your HubSpot form, they will be added to your HubSpot contact list and ReferralHero campaign.

Track a HubSpot Conversion Event

If your HubSpot contacts undergo a "Lifecycle Stage" or a "Deal Stage", you can trigger the following actions in ReferralHero:

  1. Add organic subscribers and referrals

  2. Add referrals only

  3. Total spend updates

  4. Change referral status (most common use case)

Steps:

  1. Click the "Add Event To Track" button.

  2. Provide a name for the event.

  3. Select the HubSpot event type and stage to track.

  4. Choose the 'Trigger Event Type' option corresponding to the action you want to perform in ReferralHero, such as changing a referral status.

Last updated