\refererTracker
refererTracker
This class uses the $_SERVER['HTTP_REFERER'] global variable to track
refered traffic. The class also splits up referers based on their location
(internal or external) and attaches a timestamp to each one, so that a user's
behaviour is fully logged. The class also has the ability to return the
logged referals as an array.
Example Usage:
<code>
$setSession = function($k, $v) { return \Session::put($k, $v); };
$getSession = function($k) { return \Session::get($k); };
$log = new refererTracker($getSession, $setSession);
$log->log();
</code>
- Author: John Hamelink <john@johnhamelink.com>
- Copyright: 2012 Cyber-Duck Ltd. All rights reserved.
Synopsis
class refererTracker
{
- // members
- private $_referer;
- private $_path;
- private $_setterCallback;
- private $_getterCallback;
- // methods
- public void __construct()
- private Mixed|NULL _sessionSet()
- private Mixed|NULL _sessionGet()
- private Bool _appendToSession()
- private Bool _internalReferer()
- private Bool _externalReferer()
- public Bool log()
- public Array retrieveInternal()
- public Array retrieveExternal()
- public Array retrieveAll()
- public void getDefaultSiteUrl()
- public void getIp()
- public ArrayData getData()
- public string getHtml()
- protected string getEncoded()
- public void appendToObject()
Members
private
- $_getterCallback
- $_path
- $_referer
- $_setterCallback
Methods
private
- _appendToSession() — _appendToSession
- _externalReferer() — _externalReferer
- _internalReferer() — _internalReferer
- _sessionGet() — _sessionGet
- _sessionSet() — _sessionSet
protected
- getEncoded() — Get the referer list encoded in JSON format
public
- __construct() — __construct
- appendToObject() — Append the IP and the Referer list in JSON format to an object
- getData() — Get the IP and referal list ready to be displayed in a SS template
- getDefaultSiteUrl()
- getHtml() — Get the Ip and the referal list in a basic HTML format
- getIp()
- log() — log
- retrieveAll() — retrieveAll
- retrieveExternal() — retrieveExternal
- retrieveInternal() — retrieveInternal