Identify a Subscriber
Last updated
Was this helpful?
Last updated
Was this helpful?
The RH.identify
function is used to identify a subscriber so that they don’t need to manually enter their information again, such as their email address or name. This function is particularly useful for displaying embeddable widgets on internal pages of your website where you already have the subscriber’s unique identifier.
Data (Object, Required): An object containing user data. At a minimum, this object must include the unique identifier of the user. Additional fields can be included as needed.
Force (Boolean, Optional): Determines whether to override an existing session. The default value is false
. Set this to true
to force identification even if the user is already identified.
Callback (Function, Optional): A callback function that is executed if the identification succeeds. This function receives the subscriber data as a parameter.
Important: Replace 'MFxxxxxxxxxx'
with your actual campaign UUID.
Here’s how you might use the RH.identify
function with a form submission:
Automatic Subscriber Creation: When the RH.identify
function is called, ReferralHero will check if a subscriber with that specific unique identifier exists.
If a subscriber is not found, a new subscriber is automatically created using the data sent over, bypassing the verification method.
If the subscriber with that unique identifier already exists, ReferralHero simply returns the existing subscriber data.
If you don’t want to automatically create a new subscriber when one isn't found (e.g., to allow manual opt-in), set the upsert
property to false
.
Load Callback: The ReferralHero Tracking Code loads asynchronously. If you intend to execute any RH
functions on page load, you must wait until the library has completely loaded. Use the callbacks.ready
method to ensure that the code runs only after ReferralHero has finished loading.
Force Identification: By default, if a cookie session is already present (e.g., the user has already been identified in the past), ReferralHero will not attempt to identify the user again to improve the user experience. This avoids unnecessary delays (typically around 1 second).
If you want to identify users every time regardless of an existing session, set the force
parameter to true
.
Note: Our recommendation is to not force identification, as it can degrade the user experience. If you force identification, ReferralHero will check the existence of the subscriber every time a person visits that page, which can slow down your website.
Unfortunately, if you're using ReCaptcha, RH_MFxxxxxxxxxx.identify()
will not work.