PHP code example of xsuchy09 / utm-cookie

1. Go to this page and download the library: Download xsuchy09/utm-cookie 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/ */

    

xsuchy09 / utm-cookie example snippets


UtmCookie::init(); // just init - read utm params and cookie and save new values (is auto called by first call of UtmCookie::get method)
UtmCookie::get(); // get all utm cookies as array
UtmCookie::getObject(); // get all utm cookies as object (stdClass)
UtmCookie::get('utm_source'); // get utm_source
UtmCookie::get('source'); // get utm_source

$dateInterval = DateInterval::createFromDateString('7 days');
UtmCookie::setLifetime($dateInterval);

UtmCookie::setName('utm');

UtmCookie::setOverwrite(false);