1. Go to this page and download the library: Download abhij89/utm-referer library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
abhij89 / utm-referer example snippets
return [
/*
* The key that will be used to remember the referer in the cookie.
*/
'referer_cookie_key' => 'user-referer',
/*
* The key that will be used to remember the utm tags in the cookie.
*/
'utm_cookie_key' => 'user-utms',
/*
* The sources used to determine the referer/utms.
*/
'sources' => [
Abhij89\UTMReferer\Sources\UTMSource::class,
Abhij89\UTMReferer\Sources\RequestHeader::class,
],
];
namespace App\Referer;
use Illuminate\Http\Request;
use Abhij89\Referer\Source;
class RefParameter implements Source
{
public function getReferer(Request $request): string
{
return $request->get('ref', '');
}
}