Skip to content

Instantly share code, notes, and snippets.

@ecoleman
Created August 17, 2015 20:52
Show Gist options
  • Save ecoleman/f28def073dbcb16cae7c to your computer and use it in GitHub Desktop.
Save ecoleman/f28def073dbcb16cae7c to your computer and use it in GitHub Desktop.
Noticed dropbox including a script from `marketing.dropbox.com`, and this is what's inside:
<html>
<head>
<!--[if (gte IE 9) ]>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<![endif]-->
<title>Dropbox</title>
<meta http-equiv="Content-Security-Policy" content="default-src https: 'unsafe-inline' 'unsafe-eval'; ">
</head>
<body>
<script>
(function(){
window.dataLayer = [];
window.addEventListener('message', function(event){
if(event.origin === "https://www.dropbox.com") { window.dataLayer.push(event.data); }
});
var fakeref = "",
ref_match = RegExp('[?&]referrer=([^&]*)').exec(window.location.search);
if (ref_match){ fakeref = decodeURIComponent(ref_match[1]); }
try {
if ('Object' in window && 'defineProperty' in Object){
Object.defineProperty(document,'referrer',{'get':function(){ return fakeref;}});
} else {
window.document.__defineGetter__('referrer', function () { return fakeref;});
}
} catch(e){}
if (document.referrer !== fakeref && document.referrer!=="") {
//call replace to remove the referrer
location.replace(location.href);
} else {
if (! ((navigator.doNotTrack === "yes") || (navigator.msDoNotTrack === "1")) ){
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-K8WT2R');
}
}
})();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment