Javascript Web API

The JavaScript Web API allows you to interact with ReferralHero (e.g. add new subscribers, trigger referrals, get limited participant data, and generate the embeddable widgets) using Javascript.

Note for Web Integrations:

When deciding between using our Javascript Web API or REST API to interact with ReferralHero, it is generally advisable to 'add a subscriber' using the Javascript Web API as you will take advantage of our powerful global tracking script and cookie. Once a subscriber is added to our database, you can manage that subscriber and campaign more freely using either the Javascript Web API or REST API.

Getting started

The first, mandatory, step is to install the ReferralHero Global Tracking Code on your website.

So before we go any further, follow these steps to add the Tracking Code to your website:

  1. Go to your campaign dashboard > Installation instructions and copy your Global Tracking Code

  2. Add the ReferralHero Global Tracking Code to your site so that it loads on each webpage. This is typically done by adding it to the <head> section of your website

When you install the Global Tracking Code your pages get access to the global window.RH object.

Next steps

Before using the more advanced features of the Javascript Web API, you should learn about a couple of important concepts:

After that, you can learn about:

Last updated