cyberduck/referer-tracker

Referer Tracker

Installs: 20 873

Dependents: 0

Suggesters: 0

Security: 0

Stars: 6

Watchers: 4

Forks: 1

Type:silverstripe-module

4.0.0 2017-10-27 11:56 UTC

This package is not auto-updated.

Last update: 2024-11-09 18:16:48 UTC


README

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