Track the referer path for visitors in silverstripe
PHP
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
_config initial commit Jul 21, 2014
code
LICENSE Initial commit Jul 21, 2014
README.md
composer.json

README.md

Silverstripe-Referer-Tracker

Track the referer path for visitors in silverstripe

Installation

  • Save the folder referer-tracker in your site root
  • Or add the folowing to your composer.json "cyberduck/referer-tracker": "dev-master"
  • Run a dev/build?flush=1
  • Add the following tracking code to the init function of your Page.php
public function init() {
    parent::init(); 
    $this->refererTracker = new refererTracker(function($a, $b) { return \Session::set($a, $b); }, function ($q) { return \Session::get($q); } );
    $this->refererTracker->log();
}

Usage

Returns all referers which are deemed "internal"

$this->refererTracker->retrieveInternal()

Returns all referers which are deemed "external"

$this->refererTracker->retrieveExternal()

Convenience method which returns a single, merged array of the above

$this->refererTracker->retrieveAll()