Skip to content

Instantly share code, notes, and snippets.

@ssimeonov
Created April 17, 2013 02:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save ssimeonov/5401416 to your computer and use it in GitHub Desktop.
Save ssimeonov/5401416 to your computer and use it in GitHub Desktop.
Anatomy of an online ad: ad delivery script
// This sets up AdChoice notice
document.write("<style type=\"text/css\">\n");
// AdChoice image: http://s.yimg.com/hl/a/optimized/adchoice_1.png
document.write(".can_ad_slug {font-family:arial;font-size:11px;color:#999;text-decoration:none;background-image:url(\'http://s.yimg.com/hl/a/optimized/adchoice_1.png\');background-repeat:no-repeat;background-position:right;padding:0px 14px 0px 1px !important;margin:1px 0px 1px 0;cursor:hand;height:12px;display:block;line-height:12px;}\n");
document.write(".ad_slug_table a {text-decoration:none;}\n");
document.write(".ad_slug_table div.CAN_marker { display:none }\n");
document.write("</style>\n");
document.write("<div class=\"CAN_ad\">\n");
document.write("<table class=\"ad_slug_table\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n");
// Link to click on to learn more
// It will record which ad unit the clicks is for and
// then redirect to http://info.yahoo.com/privacy/us/yahoo/relevantads.html
document.write("<tr><td align=\"right\"><a href=\"http://clicks.beap.bc.yahoo.com/yc/YnY9MS4wLjAmYnM9KDE1aGtrdjRldShnaWQkVHdWQTBqYzJMakZRR0o2VVRZdnRVd1VTTVRjekxsRnRfMGJfXzcwayxzdCQxMzY2MTYzMjcwNTgzNjQ0LHNpJDQ0NTMwNTEsc3AkOTY4NDMxMzgsY3IkMzM1MTkyOTA1MSx2JDIuMCxhaWQkMENPUU9rd05QZlEtLGN0JDI1LHlieCR2ZFJfX19Ed2xLd2liQ0k4SEdHUVVBLGJpJDE3Mzk2MTcwNTEsdyQwKSk/1/*http://info.yahoo.com/relevantads/\" class=\"CAN_link\" target=\"_blank\"><span class=\"can_ad_slug\">AdChoices</span></a></td></tr>\n");
document.write("<tr><td><!-- APT Vendor: Doubleclick -->\n");
document.write("");
// Random number for cache busting
var ord = window.ord || Math.floor(Math.random() * 1e16);
// Google ad delivery script
document.write('<script type="text/javascript" src="http://ad.doubleclick.net/N4788/adj/hn.us.hmnyh.dir.x.x.x/Celebrex_Arthritis;sz=728x90;ord=' + ord + '?"><\/script>');
document.write("\n");
// If no scripting is available
document.write("<noscript>\n");
// Yahoo click tracking (will redirect to Google)
document.write("<!-- %SCBT% --><a HREF=\"http://clicks.beap.bc.yahoo.com/yc/YnY9MS4wLjAmYnM9KDE1dTdhbzlmcShnaWQkVHdWQTBqYzJMakZRR0o2VVRZdnRVd1VTTVRjekxsRnRfMGJfXzcwayxzdCQxMzY2MTYzMjcwNTgzNjQ0LHNpJDQ0NTMwNTEsc3AkOTY4NDMxMzgsY3IkMzM1MTkyOTA1MSx2JDIuMCxhaWQkMENPUU9rd05QZlEtLGN0JDI1LHlieCR2ZFJfX19Ed2xLd2liQ0k4SEdHUVVBLGJpJDE3Mzk2MTcwNTEsciQwLHJkJDFhZTdwMjFpaykp/0/*http://global.ard.yahoo.com/SIG=15g7h30s5/M=999999.999999.999999.999999/D=yahoo/S=96843138:N/Y=YAHOO/EXP=1366170470/L=TwVA0jc2LjFQGJ6UTYvtUwUSMTczLlFt_0b__70k/B=0COQOkwNPfQ-/J=1366163270625997/K=VND6yHbc_zFI4AJoKlGCbw/A=7308269325681159395/R=0/X=6/SIG=13gee38lu/*http://ad.doubleclick.net/N4788/jump/hn.us.hmnyh.dir.x.x.x/Celebrex_Arthritis;sz=728x90;ord=1366163270.625997?\"><!-- %ECBT% -->\n");
// Google ad as a simple image
document.write("<img src=\"http://ad.doubleclick.net/N4788/ad/hn.us.hmnyh.dir.x.x.x/Celebrex_Arthritis;sz=728x90;ord=1366163270.625997?\" width=\"728\" height=\"90\" />\n");
document.write("</a>\n");
document.write("</noscript><!--QYZ 1739617051,3351929051,98.139.230.41;;N;96843138;1;--></td></tr>\n");
document.write("</table>\n");
// Yahoo impression tracking pixel
document.write("</div><img style=\"display:none\" width=0 height=0 alt=\"\" src=\"http://csc.beap.bc.yahoo.com/yi?bv=1.0.0&bs=(134i64f2m(gid$TwVA0jc2LjFQGJ6UTYvtUwUSMTczLlFt_0b__70k,st$1366163270583644,si$4453051,sp$96843138,pv$0,v$2.0))&t=D_3&al=(as$12rveflk1,aid$0COQOkwNPfQ-,bi$1739617051,cr$3351929051,ct$25,at$0,eob$-1)\">");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment