Comment on page
HubSpot
The ReferralHero / HubSpot integration is very powerful and can be used to:
- Import existing contacts from HubSpot to ReferralHero
- Automatically sync your ReferralHero subscribers to your HubSpot account
- Use your own HubSpot signup form to automatically add new HubSpot contacts to your ReferralHero campaign
- Trigger a ReferralHero action when a conversion event takes place on HubSpot
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.
If you want to automatically add ReferralHero subscribers to HubSpot follow these instructions:
- 1.Log into ReferralHero
- 2.Go to your Campaign Dashboard > Edit Campaign > Integrations > HubSpot
- 3.Click ‘Connect your HubSpot account’

4. Choose the HubSpot account that you want to connect to ReferralHero
5. Choose the HubSpot contact list from the HubSpot Domain dropdown
6. Then click Save

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).
You can use your own HubSpot signup form to collect new ReferralHero subscribers. There are two ways to add new HubSpot contacts to your ReferralHero campaign.
- 1.Add one of the following Javascript codes to the end of your HubSpot HTML form code. This code will add the new signup automatically from your HubSpot form to your ReferralHero campaign. This is the recommended method.
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.
Follow these instructions if you want to use Zapier to sync subscribers added via your HubSpot signup form to ReferralHero. This should only be used if the primary JavaScript method (used in the section above) does not work for your setup.
- 1.Turn on the HubSpot native integration by following the instructions in Sync ReferralHero subscribers to HubSpot to automatically create the custom fields in HubSpot
- 2.Log in to Zapier
- 3.Create a new Zap
- 4.Search for "HubSpot" as the Trigger App
- 5.The Trigger Event is ‘New Contact Triggers when new contact is available’

6. Connect your HubSpot account
7. In Set up trigger, add ‘Contact information: MWR’ as an additional property to retrieve

8. Click ‘Continue’ to test the trigger
9. Search for ReferralHero as the Action App
10. The Action Event is ‘Add Subscriber Adds a new subscriber to a list’

11. Connect to your ReferralHero account
12. In Set Up Action, the following five fields are mandatory fields:
- Campaign: your ReferralHero campaign
- Email address: Subscriber’s email
- Referral URL: Your default referral link address
- Full name: Subscriber’s name (add a space between First Name and Last Name)
- Referrer: MWR
- *Include Ex_Field and Ex_Field_2 if they are used to collect additional data during user sign up

13. Then Test & Continue
14. Turn on Zap
If your HubSpot contacts go through "Lifecycle Stage" or a “Deal Stage“, you can add an event in the Hubspot integration that creates a rule to trigger the following actions in ReferralHero whenever there is a defined stage change in Hubspot.
- 1.Contact added
- 2.Referral change from pending to unconfirmed/confirmed status
- 3.Total spend updates

- 1.Click the ‘Add Event To Track’ button
- 2.Give the event a name
- 3.Select the Hubspot stage to track
- 4.Select the 'Trigger Event Type' option that corresponds to the action you want to perform in ReferralHero, such as adding a contact or changing a referral status.
Last modified 1mo ago