What is the 'zref' Parameter?
What is the 'zref' Parameter?
The 'zref' parameter is a hashed value that is stored in our database relating to the affiliate_id and the id of the marketing_tool from which the user arrived at the landing page.
How do I use the 'zref' Parameter?
You should pass the 'zref' parameter to zferral as the referrer value in the event call. From there, we will calculate the customer_id, affiliate_id and the commission.
How do I get the value of the "referer" parameter?
You get it from the cookie which you set on the landing page(s). On each landing page specified in either a campaign or marketing tool (ad), you should retrieve the value of the 'zref' parameter. It will be passed in GET or POST depending on the settings: (https://zferral.com/profile/api).
The value of 'zref' parameter will look like this: 018bf22aad56842ee823bd925052eb0c%2C1325480400
It consists of two values separated by a comma. The first is a hashed value of the cookie to be set. The second is an expiration date of this cookie.
Simply follow the below snippet of code (it is provided in PHP -- you may need to alter it for a different web language).
if (!isset($_COOKIE['hash']) || $_COOKIE['hash'] == '0')
{
$zref = (isset($_GET['zref']) ? $_GET['zref'] : (isset($_POST['zref']) ? $_POST['zref'] : '0'));
$zref = explode(',', rawurldecode($zref));
$hash = $zref[0];
$dateExpire = ($dateExpire ? strtotime($dateExpire) : isset($zref[1]) ? $zref[1] : 0);
setrawcookie('hash', $hash, $dateExpire, '/');
}