Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Replace referrer to identify traffic from specific subdomains
- // https://www.bounteous.com/insights/2014/06/19/are-you-missing-referral-traffic-universal-analytics/
- function() {
- var theReferrer = document.referrer;
- if (theReferrer) {
- var myProtocol = theReferrer.match(/(https?:\/\/)/);
- var myDomain = theReferrer.match(/\/\/tatooine\.com(.+)/);
- var mySubdomain = theReferrer.match(/\/\/(.+)\.tatooine\.com(.+)/);
- var myPath = "";
- if (mySubdomain) {
- if (mySubdomain[2]) myPath = mySubdomain[2];
- // exclude referrals from the jobs subdomain
- // see referrals from all other subdomains
- if (mySubdomain[1]=="jobs") {
- return myProtocol[1]+"jobs.tatooine.com"+myPath;
- } else {
- return myProtocol[1]+mySubdomain[1]+".tatooinetheplanet.com"+myPath;
- }
- }
- // keep the else-if statement to see referrals from the main domain
- // remove it to exclude referrals from the main domain
- else if (myDomain) {
- if (myDomain[1]) myPath = myDomain[1];
- return myProtocol[1]+"tatooinetheplanet.com"+myPath;
- }
- }
- return document.referrer;
- }
Add Comment
Please, Sign In to add comment