Skip to content

Latest commit

 

History

History
35 lines (27 loc) · 914 Bytes

README.md

File metadata and controls

35 lines (27 loc) · 914 Bytes

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()