PHP code example of jflight / gacookie

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

    

jflight / gacookie example snippets




use Jflight\GACookie\GACookie;

$utma = GACookie::parse('utma');
$utmz = GACookie::parse('utmz');



$utma = GACookie::parseString('utma', '177910838.254655113.1474876189.1482142331.1482148790.58');
$utmz = GACookie::parseString('utmz', '177910838.1481550491.52.15.utmcsr=newsletter|utmccn=campaign-2016|utmcmd=email');




$utma->time_of_first_visit; // DateTime
$utma->time_of_last_visit; // DateTime
$utma->time_of_current_visit; // DateTime
$utma->session_count // Integer



$utmz->timestamp; // DateTime
$utmz->session_count // Integer
$utmz->campaign_number // Integer
$utmz->source // string
$utmz->medium // string
$utmz->campaign // string
$utmz->term // string
$utmz->content // string



echo $utma->time_of_first_visit->format('Y'); // e.g. 2014



echo $utmz['source']; // e.g. google