PHP code example of benemohamed / analytics

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

    

benemohamed / analytics example snippets



// import
use benemohamed\analytics\Analytics;

$analytics = new Analytics('UA-101958632-2',null);
// null = free TOKEN from https://ipfinder.io or sign up to get your free token ipfinder.io/auth/signup
// UA-101958632-2 = your The tracking ID / web property ID

// The hit type is pageview
$test->send();


// import
use benemohamed\analytics\Analytics;

$analytics = new Analytics('TRACKING_ID_GOES_HERE','YOUR_IPFINDER_TOKEN_GOES_HERE');


$analytics->set_uagt('dsadasdasdasdsadasd') // User agent
                ->set_hit('pageview')   // Set Hit Type
                ->set_ip('9.9.9.9')    // user IP
                ->set_location('GB')   //  Geographical Override
                ->set_host('google.com')  // hostname
                ->set_path('/hello-world') // The path portion of the page URL. Should begin with '/'.
                ->set_title('hello world - Mohamed ') // The title of the page
                ->set_event_tra('server')         //  Event Tracking
                ->set_event_act('user block')     //  Event Action
                ->set_event_lab('test')           //  Event Action
                ->parms(array(
                     'dr' => 'http://example.com', // Document Referrer
                     'cn' => '(soical)',           // Campaign Name
                     'cm' => 'organic'             // Campaign Medium
                 ))
                ;

$analytics->send(); // make the call to the server



// import
use benemohamed\analytics\Analytics;

$analytics = new Analytics('TRACKING_ID_GOES_HERE','YOUR_IPFINDER_TOKEN_GOES_HERE');

$analytics-> ->parms(array(
                     'v' => 1,
                     'tid' => 'UA-101958632-2',
                     't' => 'pageview'
                     ......
                     ......
                     ......
                     ......
                     ......
                     ......
                 ));


$analytics->send(); // make the call to the server


$analytics = new Analytics('TRACKING_ID_GOES_HERE','YOUR_IPFINDER_TOKEN_GOES_HERE');


try {
    // do something
} catch (AnalyticsException $e) {
    print $e->getMessage();
}



$analytics = new Analytics('UA-101958632-2',null);

var_dump(get_class_methods($analytics));

parms(array())