Created
July 3, 2014 11:51
-
-
Save christiantakle/51c938b0eab11542ce40 to your computer and use it in GitHub Desktop.
Naive implementaion of referrer tracking
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//-- Polyfill --------------------------------------------------------- | |
if ( !String.prototype.contains ) { | |
String.prototype.contains = function() { | |
return String.prototype.indexOf.apply( this, arguments ) !== -1; | |
}; | |
} | |
//-- Module ----------------------------------------------------------- | |
(function(exports, document, undefined) { | |
var namespace = 'tools'; | |
, makeReferrerTest = | |
function(string) { | |
return function() { | |
return document | |
.referrer | |
.toLowerCase() | |
.contains(string); | |
}; | |
} | |
exports[namespace] = { | |
makeReferrerTest: makeReferrerTest | |
}; | |
}(window, document)); | |
var fromBilletto = tools.makeReferrerTest('billetto'); | |
if(fromBilletto()) { | |
// you count implementation Ajax,Ga what not | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment