doc: Keep referrer info for Google Analytics

This commit is contained in:
Hajime Hoshi 2016-08-28 04:59:59 +09:00
parent 7693a02871
commit 6497b1102c

View File

@ -10,5 +10,10 @@
return; return;
} }
var url = 'https:' + window.location.href.substring(protocol.length); var url = 'https:' + window.location.href.substring(protocol.length);
// Pass the referrer info to the new URL for Google Analytics.
if (document.referrer) {
var referrerPart = 'referrer=' + encodeURIComponent(document.referrer);
url += (location.search ? '&' : '?') + referrerPart;
}
window.location.href = url; window.location.href = url;
})(); })();