Identify the referrer
In this section, we will explain a useful variable that can be used to retrieve the referrer code for a user. By understanding how to use the variable, you can customize your code to perform specific actions based on the referrer code. For example, by calling this variable, you would know if someone was referred or not, and then could:
Apply a discount code automatically to the checkout process
Personalize text shown on a landing page
What is the RH.referrer
variable?
RH.referrer
variable?RH.referrer
can be used to return the referrer code if the '__maitre-referrer-
' cookie is present in the user's browser. It is not a method, but rather a variable that can be called to return a value.
How can I use the RH.referrer
variable in my code?
RH.referrer
variable in my code?The RH.referrer
value is available if the '__maitre-referrer-
' cookie is present in the user's browser. This cookie is created when a user clicks on a referral link and lands on the website. If the cookie is not present, the RH.referrer
value will return undefined.
To use the RH.referrer
variable, you can call it in your code like this:
This code will check if the cookie is present, and if it is, it will log the RH.referrer
value to the console. You can replace the console.log
statement with your own logic, depending on your use case.
Can I use the RH.referrer
variable with REST APIs?
RH.referrer
variable with REST APIs?Yes, you can use the RH.referrer
variable with REST APIs if you want to send the referrer code to RH via the API. You can include the RH.referrer
value in your API request payload and send it to RH.
Last updated