Latch Referrer

[Total: 0    Average: 0/5]

This example will detect the referrer (outside your site) and put that into a cookie

Head Code:

<script src=""></script>
var myCookie = new Cookie(document,"secretname",0); // cookie is non-persistent
if (document.referrer.indexOf("js-examples") == -1) {
  // this referrer is from off site
  myCookie.referrer = document.referrer;
var REF = myCookie.referrer || "no referrer page";

Body Code:

var _a = '';
if(REF=="no referrer page")
    _a += REF;
    _a += '<a href="'+REF+'">'+REF+'</a>';

Times Viewed: 8

Leave a Reply

Your email address will not be published. Required fields are marked *