Skip to content

Cyber-Duck/referer-tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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