Skip to content

Instantly share code, notes, and snippets.

@emilbjorklund
Last active August 29, 2015 14:07
Show Gist options
  • Save emilbjorklund/edc451f3d53a8b5b4145 to your computer and use it in GitHub Desktop.
Save emilbjorklund/edc451f3d53a8b5b4145 to your computer and use it in GitHub Desktop.
<!--
Below is the exact code snippet IDG are recommending their clients to put on
every page of their site to enable retargeting.
Including quotes around the whole thing, which lots and lots
of people will add too.
Note: {NNNN} placeholders represent identifying numbers,
which I have removed and replaced with the {NNNN} parts in this example.
-->
"<script type='text/javascript'>
var axel = Math.random() + '';
var a = axel * 10000000000000;
document.write('<img src=""http://pubads.g.doubleclick.net/activity;dc_iu=/{NNNN}/DFPAudiencePixel;ord=' + a + ';dc_seg={NNNNNNNN}?"" width=1 height=1 border=0/>');
</script>
<noscript>
<img src=""http://pubads.g.doubleclick.net/activity;dc_iu=/{NNNN}/DFPAudiencePixel;ord=1;dc_seg={NNNNNNNN}?"" width=1 height=1 border=0/>
</noscript>"
<!--
So, to sum up:
1. Creating a global variable (!) named "axel". A random number between 0 and 1.
Coerced into a String, by concatenation.
WTF?
Global variables are generally something to be avoided. Will overwrite anything else already occupying that name.
2. Creating a global variable (!) named "a". Set to the value of "axel", multiplied by a very large number,
coercing it back to a Number (but still with decimal points, I think.)... WTF?
See point 1.
3. document.write. Ugh.
4. Note the double quotes in front of (and after) the src-attribute. Whoops.
5 ...in both the script and the noscript versions.
-->
@cybear
Copy link

cybear commented Oct 13, 2014

I approve of these design patterns!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment