Skip to content

Instantly share code, notes, and snippets.

@ssimeonov
Created April 17, 2013 05:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ssimeonov/5401914 to your computer and use it in GitHub Desktop.
Save ssimeonov/5401914 to your computer and use it in GitHub Desktop.
Anatomy of an online ad: Google/DoubleClick ad delivery
<!-- Template Id = 13,901 Template Name = Banner Creative (Flash) - In Page Multiples - [DFA] -->
<!-- Copyright 2006 DoubleClick Inc., All rights reserved. -->
<!-- Utilities for using Flash -->
<script src="http://s0.2mdn.net/879366/flashwrite_1_2.js">
</script>
<!-- Script to active Flash ad unit -->
<SCRIPT LANGUAGE="JavaScript">
<!--
// DoubleClick Flash ad display utility
function DCFlash(id, pVM) {
// Note: 2mdn.net is a DoubleClick domain
// Flash creative for ad
var swf = "http://s0.2mdn.net/877848/CLB012__Hiking_728x90.swf";
// Unbranded (no Celebrex) Pfizer image
var gif = "http://s0.2mdn.net/877848/Celebrex_728x90_Unbranded_Backup.3.11.13_1.gif";
var minV = 8;
var FWH = ' width="728" height="90" ';
// Target URL for non-Flash mode (with Google click tracking redirection)
// Actual target URL is http://www.celebrex.com/default.aspx?o=92295057|266113741|53480227
var url = escape("http://adclick.g.doubleclick.net/aclk?sa=L&ai=BkkTr1ABuUYnfKOz56AHh_4HQCbOj…cs%3D%3fhttp://www.celebrex.com/default.aspx?o=92295057|266113741|53480227");
var wmode = "opaque";
var bg = "same as SWF";
var dcallowscriptaccess = "never";
var openWindow = "false";
var winW = 600;
var winH = 400;
var winL = 0;
var winT = 0;
var moviePath = swf.substring(0, swf.lastIndexOf("/"));
var sm = new Array();
sm[1] = "";
sm[2] = "";
sm[3] = "";
sm[4] = "";
sm[5] = "";
var ct = new Array();
ct[0] = "";
if (ct[0].substr(0, 4) != "http") {
ct[0] = "";
}
// Different content targets for users to take action against
ct[1] = "http://www.celebrex.com/default.aspx?cmp=CLXHAFL&o=92295057|266113741|53480227";
ct[2] = "http://pfizer.com/files/products/uspi_celebrex.pdf";
ct[3] = "http://media.pfizer.com/files/products/mg_celebrex.pdf";
ct[4] = "http://www.celebrex.com/isi.aspx?cmp=CLXHAFL&o=92295057|266113741|53480227";
ct[5] = "http://www.celebrex.com/default.aspx?cmp=CLXHAFL&o=92295057|266113741|53480227";
ct[6] = "";
ct[7] = "";
ct[8] = "";
ct[9] = "";
ct[10] = "";
var fv = '"clickTag=' + url + '&clickTAG=' + url + '&clicktag=' + url + '&moviePath=' + moviePath + '/' + '&moviepath=' + moviePath + '/';
for (i = 1; i < sm.length; i++) {
if (sm[i] != "") {
fv += "&submovie" + i + "=" + escape(sm[i]);
}
}
for (i = 1; i < ct.length; i++) {
if (ct[i] != "") {
if (ct[i].indexOf("http") == 0) {
// Click tracking redirect
x = escape("http://adclick.g.doubleclick.net/aclk?sa=L&ai=BkkTr1ABuUYnfKOz56AHh_4HQCbOj…B3-0%3B0%3B92295057%3B3454-728/90%3B53480227/53398896/1%3B%3B%7Esscs%3D%3f" + ct[i]);
} else {
x = escape(ct[i]);
}
fv += "&clickTag" + i + "=" + x + "&clickTAG" + i + "=" + x + "&clicktag" + i + "=" + x;
}
}
fv += '"';
var bgo = (bg == "same as SWF") ? "" : '<param name="bgcolor" value="#' + bg + '">';
var bge = (bg == "same as SWF") ? "" : ' bgcolor="#' + bg + '"';
function FSWin() {
if ((openWindow == "false") && (id == "DCF0")) alert('openWindow is wrong.');
if ((openWindow == "center") && window.screen) {
winL = Math.floor((screen.availWidth - winW) / 2);
winT = Math.floor((screen.availHeight - winH) / 2);
}
window.open(unescape(url), id, "width=" + winW + ",height=" + winH + ",top=" + winT + ",left=" + winL + ",status=no,toolbar=no,menubar=no,location=no");
}
this.FSWin = FSWin;
ua = navigator.userAgent;
if (minV <= pVM && (openWindow == "false" || (ua.indexOf("Mac") < 0 && ua.indexOf("Opera") < 0))) {
// Preparing to instantiate Flash player
var adcode = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" id="' + id + '"' + FWH + '>' +
'<param name="movie" value="' + swf + '"><param name="flashvars" value=' + fv + '><param name="quality" value="high"><param name="wmode" value="' + wmode + '"><param name="base" value="' + swf.substring(0, swf.lastIndexOf("/")) + '"><PARAM NAME="AllowScriptAccess" VALUE="' + dcallowscriptaccess + '">' + bgo +
'<embed src="' + swf + '" flashvars=' + fv + bge + FWH + ' type="application/x-shockwave-flash" quality="high" swliveconnect="true" wmode="' + wmode + '" name="' + id + '" base="' + swf.substring(0, swf.lastIndexOf("/")) + '" AllowScriptAccess="' + dcallowscriptaccess + '"><\/embed><\/object>';
if (('x' != "j") && (typeof dclkFlashWrite != "undefined")) {
// If DoubleClick code is available, activate Flash through it
dclkFlashWrite(adcode);
} else {
// Otherwise, just write out the Flash object
document.write(adcode);
}
} else {
// Can't use Flash, use an image instead
document.write('<a target="_blank" href="' + unescape(url) + '"><img src="' + gif + '"' + FWH + 'border="0" alt="" galleryimg="no"><\/a>');
}
}
var pVM = 0;
var DCid = (isNaN("266113741")) ? "DCF2" : "DCF266113741";
// Kick it all off using a bunch of browser-specific processing
if (navigator.plugins && navigator.mimeTypes.length) {
var x = navigator.plugins["Shockwave Flash"];
if (x && x.description) {
var pVF = x.description;
var y = pVF.indexOf("Flash ") + 6;
pVM = pVF.substring(y, pVF.indexOf(".", y));
}
} else if (window.ActiveXObject && window.execScript) {
window.execScript('on error resume next\npVM=2\ndo\npVM=pVM+1\nset swControl = CreateObject("ShockwaveFlash.ShockwaveFlash."&pVM)\nloop while Err = 0\nOn Error Resume Next\npVM=pVM-1\nSub ' + DCid + '_FSCommand(ByVal command, ByVal args)\nCall ' + DCid + '_DoFSCommand(command, args)\nEnd Sub\n', "VBScript");
}
eval("function " + DCid + "_DoFSCommand(c,a){if(c=='openWindow')o" + DCid + ".FSWin();}o" + DCid + "=new DCFlash('" + DCid + "',pVM);");
//-->
</SCRIPT>
<!-- Can't use Flash ad; use an image instead -->
<noscript>
<a target="_blank" href="http://adclick.g.doubleclick.net/aclk?sa=L&ai=BkkTr1ABuUYnfKOz56AHh_4HQCbOj…cs%3D%3fhttp://www.celebrex.com/default.aspx?o=92295057|266113741|53480227">
<img src="http://s0.2mdn.net/877848/3-CBX012_GIF1_728x90_L3S.gif" width="728" height="90" border="0" alt="" galleryimg="no">
</a>
</noscript>
<!-- Ad delivery verification & analytics -->
<!-- This is Nielsen't NetRatings product -->
<!-- The script will load Facebook brand life tracking behind the scenes -->
<!-- It will also load AdSafe -->
<script type="text/javascript" src="http://secure-us.imrworldwide.com/cgi-bin/m?ci=ENT21188&am=1&mr=1&ty=js&ep=1&at=view&rt=banner&st=image&ca=cmp12600&cr=53480227&pc=92295057&r=1028618">
</script>
<!-- In the noscript case, run NetRatings & AdSafe but no Facebook -->
<noscript>
<img src="http://secure-us.imrworldwide.com/cgi-bin/m?ci=ENT21188&am=1&ep=1&at=view&rt=banner&st=image&ca=cmp12600&cr=53480227&pc=92295057&r=1028618"/>
<img src="http://pixel.adsafeprotected.com/?anid=5092&campid=cmp12600&placementid=1_92295057&creativeid=53480227"/>
</noscript>
<!-- DoubleVerify viewability verification-->
<script Src="http://cdn.doubleverify.com/dvtp_src.js?ctx=525748&cmp=7160975&sid=477325&p…1&btadsrv=doubleclick&crt=&crtname=&chnl=&unit=&pid=&uid=&dvtagver=6.1.src" type="text/javascript">
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment