Identify a Referrer
Here, we'll explore how to use the RH_MFxxxxxxxxx.referrer
variable, a powerful tool for retrieving the referrer code associated with a user. By leveraging this variable, you can tailor your code to execute specific actions based on whether or not a user was referred to your site.
The RH_MFxxxxxxxxxx.referrer
variable is a key component in tracking and utilizing referral codes in your website or application. By using this variable, you can detect whether a user has been referred by someone else and trigger specific actions based on that information. This section will guide you through the practical applications of RH_MFxxxxxxxxxx.referrer
, how it works, and how you can implement it in your own code.
What is the RH_MFxxxxxxxxxx.referrer
Variable?
RH_MFxxxxxxxxxx.referrer
Variable?The RH_MFxxxxxxxxx.referrer
variable stores the referrer code if it is available. This code can be found in the URL query string (e.g., ?mwr=xxxxxxxx
) or stored within a cookie named __maitre-referrer-
in the user's browser. The referrer code typically represents a unique identifier associated with the person who referred the user to your site.
URL-Based Referrer Code: When a user clicks on a referral link, the referrer code is appended to the URL, allowing your site to recognize the referral.
Cookie-Based Referrer Code: If the user’s browser has the
__maitre-referrer-
cookie, it indicates that the user was referred previously, even if they navigate to your site later without the referral link in the URL.
The RH_MFxxxxxxxxxx.referrer
variable does not require any specific method calls. Instead, it is automatically available in your code once the ReferralHero script is loaded on your site. When called, RH_MFxxxxxxxxxx.referrer
will return the referrer code if it exists, or undefined
if no referrer code is present.
Implementing RH_MFxxxxxxxxxx.referrer
in Your Code
RH_MFxxxxxxxxxx.referrer
in Your CodeHere’s a basic example of how you can implement the RH_Mfxxxxxxxxxx.referrer
variable in your code:
Step 1: The script waits until ReferralHero is fully loaded by using the
ready
callback.Step 2: It checks whether the
RH_MFxxxxxxxxxx.referrer
variable has a value.Step 3: Depending on whether a referrer code is present, different logic can be applied. For instance, you might apply a discount if a referrer code is found.
Important: Replace 'MFxxxxxxxxxx'
with your actual campaign UUID. This UUID is essential to get the correct referrer code.
Practical Applications of RH_MFxxxxxxxxxx.referrer
RH_MFxxxxxxxxxx.referrer
Knowing whether a user was referred allows you to enhance their experience on your website. Here are two practical examples:
Automatic Discount Application: Suppose you want to offer a special discount to users who were referred by others. By checking if
RH_MFxxxxxxxxxx.referrer
has a value, you can automatically apply a discount code during the checkout process.Personalized Landing Page Content: You can personalize the text, offers, or even the entire layout of a landing page based on the referrer code. For instance, if the user was referred by a friend, you might display a welcome message mentioning the referrer’s name.
Implementation Example Applying discount if Referred:
This is just an example; you can use it in your own way. You can replace the console.log
statement with your own logic, depending on your use case.
Last updated