1. Go to this page and download the library: Download devlop/utm-parameters 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/ */
devlop / utm-parameters example snippets
use Devlop\UtmParameters\UtmParameters;
// Capture incoming UTM parameters from the query
$utmParameters = UtmParameters::capture($request);
if ($utmParameters !== null) {
// Remember the UTM parameters in cookies for 30 days
$utmParameters->remember($response, 30);
}
use Devlop\UtmParameters\UtmParameters;
// Retrieve stored UTM parameters from cookies
$utmParameters = UtmParameters::retrieve($request);
if ($utmParameters !== null) {
// do something with the UTM parameters
// optionally forget the cookies
$utmParameters->forget($response);
}