googletag.cmd.push(function() { googletag.cmd.push(function() { // Define sizes for the different ad units var inArticleSizes = [[728, 90], [632, 81], [720,250], [720,400]], leaderboardSizes = [[728, 90], [970, 90], [970, 250], [970, 490], [970, 450], [970, 66], [930, 490], [930, 450], [930, 250], [930, 140], [632, 81]], leaderboardSizesMobile = [[320, 50], [300, 50], [300, 100], [234, 60]] railSizes = [[300, 250], [250, 250], [336, 280], [180, 150], [200, 200]]; // Create Size Mappings // @see https://support.google.com/admanager/answer/3423562?hl=en var inArticleSizeMap = googletag.sizeMapping() .addSize([768, 0], [320, 50]) .addSize([1024, 0], [560, 60]) .addSize([1200, 0], inArticleSizes) .addSize([0, 0], leaderboardSizesMobile) .build(); var leaderBoardSizeMap = googletag.sizeMapping() .addSize([768, 0], [320, 50]) .addSize([1024, 0], [560, 60]) .addSize([1200, 0], leaderboardSizes) .addSize([0, 0], leaderboardSizesMobile) .build(); var railAdSizeMap = googletag.sizeMapping() .addSize([0, 0], railSizes) .build(); // Check for ad placements // @todo: make this based on class if (document.getElementById('ad_leaderboard')) { // Define Adunit slot with sizemap var adLeaderBoard = googletag .defineSlot( adunitZone, [[320, 50]], // default size on error 'ad_leaderboard') .defineSizeMapping(leaderBoardSizeMap) .addService(googletag.pubads()) .setTargeting("position", 'a1'); } var outOfPage = googletag.defineOutOfPageSlot( adunitZone, 'out-of-page'); if (document.getElementById("in-article-vca-1")) { var inArticle1 = googletag.defineSlot( adunitZone, [[320, 50]], 'in-article-vca-1') .addService(googletag.pubads()) .defineSizeMapping(inArticleSizeMap) .setTargeting("position", 'a2'); } if (document.getElementById('in-article-vca-2')) { var inArticle2 = googletag.defineSlot( adunitZone, [[320, 50]], 'in-article-vca-2') .defineSizeMapping(inArticleSizeMap) .addService(googletag.pubads()) .setTargeting("position", 'a3'); } if (document.getElementById('adunit-atf')) { var billboardAtf = googletag.defineSlot( adunitZone, [[300, 250]], 'adunit-atf') .defineSizeMapping(railAdSizeMap) .addService(googletag.pubads()) .setTargeting("position", 'a2'); } if (document.getElementById('adunit-btf')) { var billboardBtf = googletag.defineSlot( adunitZone, [[320,250]], 'adunit-btf') .defineSizeMapping(railAdSizeMap) .addService(googletag.pubads()) .setTargeting("position", 'a4'); } googletag.pubads() .setTargeting('content_id', contentId) .setTargeting('search_term', searchTerm) .setTargeting('content_type', [contentType]) .setTargeting('host', 'www.business.com') .setTargeting('page_zone', [pageAdZone]) .setTargeting('topics', [dfpTags]) .setTargeting('URL', 'http://www.business.com/articles/investing-for-small-business-owners/') .setTargeting('zone_type', [zoneType]); googletag.pubads().enableSingleRequest(); googletag.pubads().collapseEmptyDivs(); googletag.enableServices(); }); }); if (document.getElementById('in-article-vca-1')) { googletag.cmd.push(function() { googletag.display('in-article-vca-1'); }); } if (document.getElementById('in-article-vca-2')) { googletag.cmd.push(function() { googletag.display('in-article-vca-2'); }); } if (document.getElementById('adunit-atf')) { googletag.cmd.push(function() { googletag.display('adunit-atf') }) }