PHP code example of neoan3-apps / simple-tracker

1. Go to this page and download the library: Download neoan3-apps/simple-tracker 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/ */

    

neoan3-apps / simple-tracker example snippets


$visits = [
    [
        'date'       => (string) $date, // format Y-m-d H:i:s
        'endpoint'   => (string) $endpoint, // fully qualified
        'referrer'   => (string) $from, // if known, referrer (defaults to NULL)
        'identifier' => (string) $custom_identifier // however you want to track a user/session 
    ], ...
]


$page = 'https://mysite.com/about-me/';

// return Filebase Document
$data = Neoan3\Apps\SimpleTracker::endpointData($page)->toArray();

$totalVisits = count($data['visits']);


$user =  Neoan3\Apps\SimpleTracker::identifierData(Neoan3\Apps\Session::user_id());

// get recent activity of current user

$recent = $user->filter('visits', date('Y-m-d H:i:s',strtotime('last monday')), function($item, $date){
            return ($item['date'] == $date ? $item : false);
        })