Home Page: Journal of Surgical Research



Property Value
Status
Version
Ad File
Disable Ads Flag
Environment
Moat Init
Moat Ready
Contextual Ready
Contextual URL
Contextual Initial Segments
Contextual Used Segments
AdUnit
SubAdUnit
Custom Targeting
Ad Events
Invalid Ad Sizes

0) { gptDisableAds_Debug = ‘Flag Detected – Ads Disabled’; gpt_DisableAdsFlagFound = true; } else { gptDisableAds_Debug = ‘Ads Enabled’; gpt_DisableAdsFlagFound = false; } switch (gpt_AdFile) { case ‘PU’: gptContextualEnabled = true; if ($(“#Environment”).val() !== “Prod”) { gpt_IsProd = false; gptTestENV_Debug = ‘Test Environment Detected’; } else { gptTestENV_Debug = ‘Production Environment Detected’; } break; case ‘JBS’: case ‘LANCET’: gptContextualEnabled = true; if ($(“.gpt-ad”).length > 0) { //Other ads exist, allow the Prestitial $(document.body).append(“]]>”); } if (window.location.hostname.toLowerCase().indexOf(‘.literatumonline.’) >= 0) { gpt_IsProd = false; gptTestENV_Debug = ‘Test Environment Detected’; } else { gptTestENV_Debug = ‘Production Environment Detected’; } break; default: //Cell gptContextualEnabled = false; if (window.location.hostname.toLowerCase().indexOf(‘.literatumonline.’) >= 0) { gpt_IsProd = false; gptTestENV_Debug = ‘Test Environment Detected’; } else { gptTestENV_Debug = ‘Production Environment Detected’; } break; } } //————————————————————————– function gpt_GetNonCMEArticle() { var url; $(‘.articleCitation’).each(function (i, obj) { if ($(obj).find(‘.toc__item__detials’).length > 0) { var itemDetails = $(obj).first().find(‘.toc__item__detials’); var x1 = $(itemDetails).find(“img[title~=’Education’]”).length; var x2 = $(itemDetails).find(“img[title~=’CME’]”).length; if (x1 == 0 && x2 == 0) { var itemLink = $(itemDetails).first().find(‘.toc__item__title’); var linkCount = $(itemLink).first().find(“a:contains(‘CME’)”).length; if (linkCount == 0) { url = $(itemLink).first().find(‘a’).attr(‘href’); return false; } } } }); return url; } //————————————————————————– function gpt_GetElapsedTime() { var endTime = new Date(); var timeDiff = endTime – gpt_StartTime; //in ms // strip the ms timeDiff /= 1000; // get seconds return seconds = Math.round(timeDiff) + ” seconds”; } //————————————————————————– function gpt_CheckSSC() { //Check for ScreenShot Client var gpt_SSC = gpt_GetQuerystring(‘gpt_ssc’, ”); if (gpt_SSC == ‘1’) { //it’s the ScreenShotClient, disable MOAT IVT Detection $(‘#gpt-Variables’).append(”); $(‘#gptm_data’).val(0); gpt_Target(“m_data”); } } //————————————————————————– function gpt_LocalSS(adTypeId) { window.scrollTo(0, 0); gpt_Sleep(1000); gpt_ScrollToAd(adTypeId); gpt_PreTearsheet(adTypeId); } //————————————————————————– function gpt_InitScripts() { if (gpt_AdFile == “PU”) { if (gpt_IsProd) { gpt_ContextualURL = gpt_CheckForNULL($(‘#canonicalurl’).val()); if (gpt_ContextualURL === null) { gpt_ContextualURL = window.location.href.split(‘?’)[0].split(‘#’)[0]; } else { gpt_ContextualURL = window.location.origin + gpt_ContextualURL; } var useSSL = ‘https:’ == document.location.protocol; var gs = document.createElement(‘script’); gs.async = true; gs.type = ‘text/javascript’; gs.src = (useSSL ? ‘https:’ : ‘http:’) + ‘//elsevier.gscontxt.net/multizone/channels.cgi?url=’ + encodeURIComponent(gpt_ContextualURL); gs.onload = function () { gpt_ContextualReady = true; }; document.head.appendChild(gs); } } else { //JBS-Cell-Lancet var useSSL = ‘https:’ == document.location.protocol; var gads = document.createElement(‘script’); gads.async = true; gads.type = ‘text/javascript’; gads.src = (useSSL ? ‘https:’ : ‘http:’) + ‘//securepubads.g.doubleclick.net/tag/js/gpt.js’; document.head.appendChild(gads); if (gpt_IsProd && gptContextualEnabled) { gpt_ContextualURL = window.location.href.split(‘?’)[0].split(‘#’)[0]; var gs = document.createElement(‘script’); gs.async = true; gs.type = ‘text/javascript’; gs.src = (useSSL ? ‘https:’ : ‘http:’) + ‘//elsevier.gscontxt.net/multizone/channels.cgi?url=’ + encodeURIComponent(gpt_ContextualURL); gs.onload = function () { gpt_ContextualReady = true; }; document.head.appendChild(gs); } var elsevierMoatHeader = document.createElement(‘link’); elsevierMoatHeader.rel = ‘preload’; elsevierMoatHeader.as = ‘script’; elsevierMoatHeader.src = (useSSL ? ‘https:’ : ‘http:’) + ‘//z.moatads.com/elsevierheader150204004183/moatheader.js’; document.head.appendChild(elsevierMoatHeader); var elsevierMoatAds = document.createElement(‘link’); elsevierMoatAds.rel = ‘preconnect’; elsevierMoatAds.src = (useSSL ? ‘https:’ : ‘http:’) + ‘//mb.moatads.com’; document.head.appendChild(elsevierMoatAds); var moatHeader = document.createElement(‘script’); moatHeader.async = true; gads.type = ‘text/javascript’; moatHeader.src = (useSSL ? ‘https:’ : ‘http:’) + ‘//z.moatads.com/elsevierheader150204004183/moatheader.js’; document.head.appendChild(moatHeader); } } //————————————————————————– async function gpt_CheckForMOATInit() { //Check every 1/10 of a second until MOAT is Loaded or 1 second timeout if (gpt_MOATInitAttempts < gpt_MaxMOATInitAttempts) { gpt_MOATInitAttempts += 1; if (typeof window.moatPrebidApi === "object") { //MOAT LOADED gptMoatInit_Debug = '0.0' + gpt_MOATInitAttempts + ' seconds'; gpt_CheckForMOATReady(); } else { setTimeout(() => { gpt_CheckForMOATInit(); }, 100); } } else { //TIMEOUT: MOAT Not LOADED gptMoatInit_Debug = ‘Timeout Expired’; var googletag = googletag || {}; googletag.cmd = googletag.cmd || []; gpt_CheckForContextualReady(); } } //————————————————————————– function gpt_CheckForMOATReady() { //Check every 1/10 of a second until MOAT is Ready or 1 second timeout if (gpt_MOATReadyAttempts < gpt_MaxMOATReadyAttempts) { gpt_MOATReadyAttempts += 1; if (window.moatPrebidApi.safetyDataAvailable()) { //MOAT Ready gptMoatReady_Debug = '0.0' + gpt_MOATReadyAttempts + " seconds"; gpt_CheckForContextualReady(); } else { setTimeout(() => { gpt_CheckForMOATReady(); }, 100); } } else { //TIMEOUT: MOAT Not Ready gptMoatReady_Debug = ‘Timeout Expired’; gpt_CheckForContextualReady(); } } //————————————————————————– function gpt_CheckForContextualReady() { //Check every 1/10 of a second until Contextual is Ready or 2 second timeout if (gpt_IsProd && gptContextualEnabled) { //Enabled if (gpt_ContextualReadyAttempts < gpt_MaxContextualReadyAttempts) { gpt_ContextualReadyAttempts += 1; if (gpt_ContextualReady) { //Contextual Ready gptContextualURL_Debug = gpt_ContextualURL; gptContextualReady_Debug = '0.0' + gpt_ContextualReadyAttempts + " seconds"; gptContextualInit_Debug = gs_channels; gpt_InitAds(); } else { setTimeout(() => { gpt_CheckForContextualReady(); }, 100); } } else { //LOG TIMEOUT error //REMOVE FOR NOW (SHOULD LOG TO A DIFF LOCATION) //TIMEOUT: Contextual Not Ready $(‘#gpt_GrapeShotDebugBtn’).remove(); gptContextualURL_Debug = gpt_ContextualURL; gptContextualReady_Debug = ‘Timeout Expired’; gptContextualInit_Debug = “”; gpt_InitAds(); } } else { //Not Enabled $(‘#gpt_GrapeShotDebugBtn’).remove(); switch (gpt_AdFile) { case ‘PU’: case ‘LANCET’: case ‘JBS’: gptContextualURL_Debug = ‘Not enabled outside of Production’; gptContextualReady_Debug = ‘Not enabled outside of Production’; gptContextualInit_Debug = ‘Not enabled outside of Production’; break; case “CELLJOURNAL”: case “CELLBUCKET”: gptContextualReady_Debug = ‘Not enabled on Cell’; gptContextualInit_Debug = ‘Not enabled on Cell’; gptContextualURL_Debug = ‘Not enabled on Cell’; break; } gpt_InitAds(); } } //————————————————————————– function GPT_GetPageByURL() { var host = window.location.host.toLocaleLowerCase() var localpath = window.location.pathname.toLocaleLowerCase(); ///Check for Cell.com if (host.indexOf(‘cell.com’) >= 0) { return null; } ///Check for Cell.com (marlin-stag) if (host.indexOf(‘www-cell-com’) >= 0) { return null; } ///Check for Lancet if (host.indexOf(‘thelancet’) >= 0) { return null; } if (localpath.indexOf(‘/article/’) >= 0) { return ‘article.fulltext’; } if (localpath.indexOf(‘/action/dosearch’) >= 0) { return ‘search.searchResults’; } if (localpath.indexOf(‘/content/’) >= 0) { return ‘periodical.editorial’; } return ‘periodical.home’; } //————————————————————————– function gpt_CheckForNULL(x, valueifnull) { if (typeof valueifnull == “undefined”) { valueifnull = null; } if (typeof x == ‘undefined’) { return valueifnull; } if (x == null) { return valueifnull; } if (x == “null”) { return valueifnull; } if ($.trim(x) == ”) { return valueifnull; } return x; } //————————————————————————– function gpt_GetAdditionalTargeting() { //adds page level targeting of custom variables //the id (minus gpt) and the value will be used as a key-value pair //eg: //eg: target issuepii=x $(“.gpt-Target”).each(function (index) { var gptTargetId = $(this).attr(‘id’); gptTargetId = gptTargetId.replace(‘gpt’, ”).toLowerCase(); if (gptTargetId !== ”) { gpt_Target(gptTargetId); } }) } //————————————————————————– function gpt_GetQuerystring(key, default_) { //function to read querystring variables if (default_ === null) default_ = ”; key = key.replace(/[[]/, “\[“).replace(/[]]/, “\]”); var regex = new RegExp(“[\?&]” + key + “=([^]*)”); var qs = regex.exec(window.location.href); if (qs === null) return default_; else return qs[1]; } //————————————————————————– function gpt_GetDFPTestId() { //Get any request for a test id from querystring and set custom targeting parameter var gptDFPTestId = gpt_GetQuerystring(‘dfptestid’, ”); if (gptDFPTestId !== ”) { $(‘#gpt-Variables’).append(”); $(‘#gptDFPTestId’).val(gptDFPTestId); gpt_Target(“DFPTestId”); } } //————————————————————————– function gpt_Target(targetName) { //Set page level target if value is found if ($(‘#gpt’ + targetName).length > 0) { var targetValue = $(‘#gpt’ + targetName).val(); if (targetValue !== ”) { targetValue = targetValue.replace(/[^-a-z0-9]/ig, ”); //Only Allow a-z, 0-9 googletag.pubads().setTargeting(targetName.toLowerCase(), targetValue.toLowerCase()); gptCustomTargeting_Debug = gptCustomTargeting_Debug + targetName.toLowerCase() + ‘ = ‘ + targetValue.toLowerCase() + ‘
‘; } } } //————————————————————————– function gpt_TargetAccessType() { var currentAccessType = $(‘#gptAccessType’).val(); if (typeof currentAccessType == “undefined”) { currentAccessType = “”; } if (currentAccessType.indexOf(‘ANON_IP’) >= 0) { googletag.pubads().setTargeting(“loggedin”, “yes”); } else { gpt_Target(“LoggedIn”); } } //————————————————————————– async function gpt_PreTearsheet(adTypeId) { if (typeof adTypeId === “undefined”) { adTypeId = 0; } //Remove Elsevier Cookie Policy Notice if ($(“#onetrust-consent-sdk”).length > 0) { $(“#onetrust-consent-sdk”).remove(); } //Mobile Nav $(‘#skip’).remove(); $(‘#skipNavigationLink’).remove(); //JBS Modals if ($(‘.leadinModal’).length > 0) { $(‘.leadinModal’).remove(); } if ($(‘.leadinModal’).length > 0) { $(‘.leadinModal’).remove(); } if ($(‘.usabilla__overlay’).length > 0) { $(‘.usabilla__overlay’).remove(); } //Pendo if ($(‘._pendo-step-container’).length > 0) { $(‘._pendo-step-container’).remove(); } if ($(‘._pendo-guide-tt_’).length > 0) { $(‘._pendo-guide-tt_’).remove(); } if ($(‘._pendo-image’).length > 0) { $(‘._pendo-image’).remove(); } if ($(‘._pendo-badge-image’).length > 0) { $(‘._pendo-badge-image’).remove(); } switch (gpt_AdFile) { case “CELLJOURNAL”: case “CELLBUCKET”: //Mobile Bug Fix on Cell if (parseInt(adTypeId) == 5) { $(‘.widget-horizontalAd’).css(‘position’, ‘static’); $(‘.body-horizontalAd’).css(‘display’, ‘block’); } break; case “JBS”: case “LANCET”: objLeaderboard = “.container-leaderboard”; offset = 53; switch (parseInt(adTypeId)) { case 3: //MPU case 4: //SkyScraper //BUGFIX: Show Sidebar ad for JBS //skyscraper & mpu if ($(‘.widget-verticalAd’).length > 0) { $(‘.widget-verticalAd’).css(‘display’, ‘block’); } $(‘#backgroundLayer’).css(‘display’, ‘none’); //Hide any Prestitial break; case 6: //Prestitial $(‘#backgroundLayer’).css(‘display’, ‘block’); break; default: $(‘#backgroundLayer’).css(‘display’, ‘none’); //Hide any Prestitial break; } break; } } //————————————————————————– function gpt_Sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } //————————————————————————– async function gpt_ScrollToAd(adTypeId) { if (typeof adTypeId === “undefined”) { adTypeId = 0; } var adId = “”; var offset = 0; var objLeaderboard = “”; var gpt_ScrollToAd = true; switch (gpt_AdFile) { case “PU”: //PracticeUpdate var hideOtherAds = true; $(‘#modalPrestitial’).modal(‘hide’); $(‘.jumbotron-welcome’).hide(); objLeaderboard = “.container-leaderboard”; offset = 53; switch (parseInt(adTypeId)) { case 2: //LeaderBoard, no Scroll Needed gpt_ScrollToAd = false; adId = “adSlot1”; break; case 3: //MPU adId = “adSlot2”; break; case 4: //SkyScraper adId = “adSlot3”; $(‘.most-read’).hide(); break; case 5: //Mobile, no Scroll Needed gpt_ScrollToAd = false; adId = “adSlot1”; break; case 6: //Interstitial gpt_ScrollToAd = false; adId = “adSlot15”; await gpt_Sleep(1000); $(objLeaderboard).hide(); $(‘#modalPrestitial’).unbind(); $(‘#modalPrestitial’).modal(); break; case 7: //Native Ad break; case 10: //Master Companion hideOtherAds = false; gpt_ScrollToAd = false; break; default: //Unknown Ad Type gpt_ScrollToAd = false; adId = “adSlot1”; break; } if (hideOtherAds) { //Hide all other ads $(‘.ad-container’).each(function (i, obj) { if (this.id !== adId) { var tempParent = this.id; tempParent = tempParent.replace(“adSlot”, “adParent”); $(“#” + tempParent).addClass(‘hide’); } }); } break; case “JBS”: objLeaderboard = “.js__adToHide”; offset = 80; switch (parseInt(adTypeId)) { case 2: //Leaderboard gpt_ScrollToAd = false; $(“.widget-verticalAd”).hide(); break; case 5: //Mobile //Scroll to Top gpt_ScrollToAd = false; break; case 3: //MPU case 4: //SkyScraper $(objLeaderboard).hide(); adId = $(‘.gpt-ad-defined[data-adsize=”sidebar”‘).attr(‘id’); break; case 10: //MasterCompanion gpt_ScrollToAd = false; break; case 13: //Phone – Portrait case 14: //Phone – Landscape $(objLeaderboard).hide(); offset = 60; adId = ‘gpt-Interscroller’; gpt_ScrollToAd = true; break; default: //Unknown Ad Type gpt_ScrollToAd = false; break; } break; case “CELLJOURNAL”: case “CELLBUCKET”: objLeaderboard = “.js__adToHide”; offset = 260; switch (parseInt(adTypeId)) { case 2: //Leaderboard gpt_ScrollToAd = false; $(‘.body-verticalAd’).hide(); break; case 5: //Mobile //Scroll to Top gpt_ScrollToAd = false; break; case 3: //MPU case 4: //SkyScraper $(objLeaderboard).hide(); adId = $(‘.gpt-ad-defined[data-adsize=”boombox”‘).attr(‘id’); break; case 10: //MasterCompanion gpt_ScrollToAd = false; break; default: //Unknown Ad Type gpt_ScrollToAd = false; break; } //Hide the second ad if found var tCount = 0; $(“.widget.literatumAd.none.GPT-ad-placeholder.widget-horizontalAd.widget-compact-all”).each(function (index) { tCount += 1; if (tCount !== 1) { $(this).hide(); } }); break; case “LANCET”: objLeaderboard = “.js__adToHide”; offset = 80; switch (parseInt(adTypeId)) { case 2: //Leaderboard gpt_ScrollToAd = false; $(‘.body-verticalAd’).hide(); break; case 5: //Mobile //Scroll to Top gpt_ScrollToAd = false; break; case 3: //MPU case 4: //SkyScraper $(objLeaderboard).hide(); adId = $(‘.gpt-ad-defined[data-adsize=”skyscraper”‘).attr(‘id’); break; case 10: //MasterCompanion gpt_ScrollToAd = false; break; default: //Unknown Ad Type gpt_ScrollToAd = false; break; } break; } //Scroll to Top var gpt_container = $(“html,body”); gpt_container.animate({ scrollTop: 0, scrollLeft: 0 }); if (gpt_ScrollToAd) { //If Adexists, scroll to it var gpt_scrollTo = $(‘#’ + adId); if (gpt_scrollTo.length > 0) { //Scroll to the Ad var gpt_topPosition = gpt_scrollTo.offset().top – gpt_container.offset().top + gpt_container.scrollTop(); if (gpt_topPosition > 0) { gpt_container.animate({ scrollTop: gpt_topPosition, scrollLeft: 0 }); if (gpt_topPosition – offset > 0 && offset > 0) { gpt_container.animate({ scrollTop: gpt_topPosition – offset, scrollLeft: 0 }); } } } } } //————————————————————————– async function gpt_CheckForCookiePolicy() { var returnVal = false; if ($(‘#onetrust-accept-btn-handler’).length > 0) { $(‘#onetrust-accept-btn-handler’).click(); returnVal = true; } return returnVal; } //————————————————————————– function gpt_InitAds() { var gpt_ResponsiveHomepage = false; switch (gpt_AdFile) { case “JBS”: case “CELLJOURNAL”: case “CELLBUCKET”: //Responsive Check if ($(‘#hdrHomeBrand’).length > 0) { gpt_ResponsiveHomepage = true; } break; } //InterScroller Check if (gpt_AdFile === “JBS”) { var gpt_InterScrollerEnabled = false; var gpt_InterScrollerInsertObj; if ($(“#articleHeader”).length > 0) { //It’s an article Page if ($(‘.article__sections > section’).length > 0) { gpt_InterScrollerEnabled = true; gpt_InterScrollerInsertObj = $(“.article__sections > section”); } } else { if ($(‘.toc__section’).length > 0) { //It’s a TOC Page gpt_InterScrollerEnabled = true; gpt_InterScrollerInsertObj = $(“.toc__section”).first(); } } //Add the Interscroller if (gpt_InterScrollerEnabled) { gpt_InterScrollerInsertObj.first().append($(“#gpt-Interscroller”).clone()); $(“#gpt-Interscroller”).remove(); $(“.gpt-adinterscroller”).addClass(“gpt-ad”); } } googletag.cmd.push(function () { var gptBoomBoxSizeMapping; var gptFluidMapping; var gptHomePageSidebarMapping; var gptCellHomePageSidebarMapping; var gptInterscrollerMapping; var gptLeaderboardSizeMapping; var gptMobileSizeMapping; var gptPrestitialMapping; var gptRectangleShortSizeMapping; var gptRectangleSizeMapping; var gptSideBarSizeMapping; var gptTallSizeMapping; var gptWideSizeMapping; var gptWideRectangleSizeMapping; //*********************************************** //Start Define Size mapping based on client Viewport //*********************************************** if (gpt_AdFile === ‘PU’) { gptTallSizeMapping = googletag.sizeMapping(). addSize([992, 0], [[300, 600], [160, 600], [120, 600]]). addSize([0, 0], []). build(); gptRectangleSizeMapping = googletag.sizeMapping(). addSize([992, 0], [[300, 250]]). addSize([0, 0], []). build(); gptRectangleShortSizeMapping = googletag.sizeMapping(). addSize([992, 0], [[300, 250], [320, 50], [300, 50]]). addSize([0, 0], [[300, 250], [320, 50], [300, 50]]). build(); gptWideSizeMapping = googletag.sizeMapping(). addSize([992, 0], [[728, 90]]). addSize([760, 0], [[728, 90], [320, 50], [300, 50]]). addSize([0, 0], [[320, 50], [300, 50]]). build(); gptWideRectangleSizeMapping = googletag.sizeMapping(). addSize([992, 0], []). addSize([760, 0], [[320, 50], [300, 50], [300, 250]]). addSize([0, 0], [[320, 50], [300, 50], [300, 250]]). build(); gptMobileSizeMapping = googletag.sizeMapping(). addSize([0, 0], [[320, 50], [300, 50]]). build(); gptFluidMapping = googletag.sizeMapping(). addSize([0, 0], [‘fluid’]). build(); gptPrestitialMapping = googletag.sizeMapping(). addSize([760, 0], [[1, 1]]). build(); } else { //JBS-CELL-LANCET gptLeaderboardSizeMapping = googletag.sizeMapping(). addSize([992, 0], [[728, 90]]). // Desktop addSize([768, 0], [[728, 90]]). // Tablet Landscape addSize([0, 0], [[320, 50], [300, 50]]). // Phone & Tablet Portrait build(); gptHomePageSidebarMapping = googletag.sizeMapping(). addSize([2090, 795], [[300, 600], [300, 250], [160, 600], [120, 600]]). addSize([1910, 795], [[160, 600], [120, 600]]). addSize([0, 0], []). build(); gptCellHomePageSidebarMapping = googletag.sizeMapping(). addSize([2090, 795], [[300, 600], [300, 250], [336, 280], [160, 600], [120, 600]]). addSize([1910, 795], [[160, 600], [120, 600]]). addSize([0, 0], []). build(); gptSideBarSizeMapping = googletag.sizeMapping(). addSize([1140, 795], [[300, 600], [160, 600], [120, 600], [300, 250]]). // SkyScraper – Desktop (Require min 630 vertical) addSize([1140, 445], [[300, 250]]). // BoomBox Fall Back – Desktop (Require min 280 vertical) addSize([0, 0], []). // Phone build(); gptBoomBoxSizeMapping = googletag.sizeMapping(). addSize([768, 0], [[300, 250], [336, 280]]). // Desktop & Tablet Landscape addSize([0, 0], []). // Phone build(); gptFluidMapping = googletag.sizeMapping(). addSize([0, 0], [‘fluid’]). build(); gptPrestitialMapping = googletag.sizeMapping(). addSize([600, 700], [[1, 1]]). // Desktop & Tablet Landscape addSize([0, 0], []). // Phone build(); gptInterscrollerMapping = googletag.sizeMapping(). addSize([1140, 445], []). addSize([1024, 768], [[1024, 768]]). addSize([768, 1024], [[768, 1024]]). addSize([480, 320], [[480, 320]]). addSize([320, 480], [[320, 480]]). build(); } //*********************************************** //End Define Size mapping based on client Viewport //*********************************************** //*********************************************** //Start detection for ad slots on page //*********************************************** var gptMasterPage = gpt_CheckForNULL($(‘#gptPage’).val()); var gptMasterSite; if (gpt_AdFile === ‘PU’) { gptMasterSite = $(‘#gptSite’).val(); } else { //JBS-CELL-LANCET gptMasterSite = “dev”; if (gpt_IsProd) { gptMasterSite = gpt_CheckForNULL($(‘#gptSite’).val()); //If there is no master site, check for a defaultsite if (gptMasterSite == null) { gptMasterSite = gpt_CheckForNULL($(‘#gptDefaultSite’).val()); } } else { //Dev ENV //If the page has no gptSite Value, assume no value which will disable ads if (gpt_CheckForNULL($(‘#gptSite’).val()) === null) { gptMasterSite = null; } } //If there is no master Page, check for a Page using the URL if (gptMasterPage === null) { gptMasterPage = GPT_GetPageByURL(); } } $(“.gpt-ad”).each(function (index) { var gptPage = ”; var adSizeMapping = ”; var gptPOS; var gptTC; var gptNative; var adId; var gptSite; var tempSlot = null; if (gpt_IsProd) { //Check if the ad slot has it’s own site defined if (typeof $(this).data(‘site’) === ‘undefined’) { gptSite = gptMasterSite; } else { gptSite = gpt_CheckForNULL($(this).data(‘site’)); } } else { gptSite = gptMasterSite; } if (gpt_AdFile === ‘PU’) { adId = $(this).attr(‘id’); } else { //JBS-CELL-LANCET adId = ‘gpt-ad-‘ + index + 1; } if (gpt_CheckForNULL(gptSite) !== null) { gptSite_Debug = gptSite; gptPOS = parseInt($(this).data(‘pos’)) || -1; if (gptPOS === -1) { gptPOS = index + 1; } //Check if the ad slot has it’s own page defined gptPage = $(this).data(‘page’); if (gpt_CheckForNULL(gptPage) == null) { //Use the Master Page gptPage = gptMasterPage; } //If the page is not null, preceed it with a slash if (gptPage !== null) { gptPage = ‘/’ + gptPage; } else { gptPage = ”; } gptPage_Debug = gptPage; gptTC = $(this).data(‘tc’); if (typeof gptTC === “undefined”) { gptTC = ”; } gptNative = $(this).data(‘native’); if (typeof gptNative === “undefined”) { gptNative = ”; } //Determine sizemapping based on data-adsize if (gpt_AdFile === ‘PU’) { switch ($(this).data(‘adsize’)) { case ‘tall’: adSizeMapping = gptTallSizeMapping; tempSlot = googletag.defineSlot(‘/6053/els.’ + gptSite + gptPage, [[120, 600], [160, 600], [300, 600]], adId); break; case ‘rectangle’: adSizeMapping = gptRectangleSizeMapping; tempSlot = googletag.defineSlot(‘/6053/els.’ + gptSite + gptPage, [[300, 250]], adId); break; case ‘rectangleshort’: adSizeMapping = gptRectangleShortSizeMapping; tempSlot = googletag.defineSlot(‘/6053/els.’ + gptSite + gptPage, [[300, 250], [320, 50], [300, 50]], adId); break; case ‘wide’: adSizeMapping = gptWideSizeMapping; tempSlot = googletag.defineSlot(‘/6053/els.’ + gptSite + gptPage, [[728, 90], [320, 50], [300, 50]], adId); break; case ‘widerectangle’: adSizeMapping = gptWideRectangleSizeMapping; tempSlot = googletag.defineSlot(‘/6053/els.’ + gptSite + gptPage, [[320, 50], [300, 50], [300, 250]], adId); break; case ‘mobile’: adSizeMapping = gptMobileSizeMapping; tempSlot = googletag.defineSlot(‘/6053/els.’ + gptSite + gptPage, [[320, 50], [300, 50]], adId); break; case ‘fluid’: adSizeMapping = gptFluidMapping; tempSlot = googletag.defineSlot(‘/6053/els.’ + gptSite + gptPage, ‘fluid’, adId); break; case ‘prestitial’: adSizeMapping = gptPrestitialMapping; tempSlot = googletag.defineSlot(‘/6053/els.’ + gptSite + gptPage, [[1, 1]], adId); break; } } else { //JBS-CELL-LANCET switch ($(this).data(‘adsize’)) { case ‘cell-leaderboard’: case ‘leaderboard’: adSizeMapping = gptLeaderboardSizeMapping; tempSlot = googletag.defineSlot(‘/6053/els.’ + gptSite + gptPage, [[728, 90], [320, 50], [300, 50]], adId); break; case ‘bottom’: if (gpt_ResponsiveHomepage) { adSizeMapping = gptHomePageSidebarMapping; tempSlot = googletag.defineSlot(‘/6053/els.’ + gptSite + gptPage, [[120, 600], [160, 600], [300, 600], [300, 250]], adId); } else { adSizeMapping = gptBoomBoxSizeMapping; tempSlot = googletag.defineSlot(‘/6053/els.’ + gptSite + gptPage, [[300, 250]], adId); } break; case ‘boombox’: if (gpt_AdFile === “CELLJOURNAL” || gpt_AdFile == “CELLBUCKET”) { if (gpt_ResponsiveHomepage) { adSizeMapping = gptCellHomePageSidebarMapping; tempSlot = googletag.defineSlot(‘/6053/els.’ + gptSite + gptPage, [[120, 600], [160, 600], [300, 600], [300, 250], [336, 280]], adId); } else { adSizeMapping = gptBoomBoxSizeMapping; tempSlot = googletag.defineSlot(‘/6053/els.’ + gptSite + gptPage, [[300, 250], [336, 280]], adId); } } else { adSizeMapping = gptBoomBoxSizeMapping; tempSlot = googletag.defineSlot(‘/6053/els.’ + gptSite + gptPage, [[300, 250]], adId); } break; case ‘interscroller’: adSizeMapping = gptInterscrollerMapping; tempSlot = googletag.defineSlot(‘/6053/els.’ + gptSite + gptPage, [[320, 480], [480, 320], [768, 1024], [1024, 768]], adId); break; case ‘sidebar’: case ‘skyscraper’: adSizeMapping = gptSideBarSizeMapping; tempSlot = googletag.defineSlot(‘/6053/els.’ + gptSite + gptPage, [[120, 600], [160, 600], [300, 600], [300, 250]], adId); break; case ‘native’: case ‘fluid’: adSizeMapping = gptFluidMapping; tempSlot = googletag.defineSlot(‘/6053/els.’ + gptSite + gptPage, ‘fluid’, adId); break; case ‘prestitial’: adSizeMapping = gptPrestitialMapping; tempSlot = googletag.defineSlot(‘/6053/els.’ + gptSite + gptPage, ‘fluid’, adId); break; } } } //Ignore any invalid adsizes that could be on the page if (adSizeMapping !== ”) { $(this).addClass(‘gpt-ad-defined’); if (gpt_AdFile !== ‘PU’) { $(this).attr(‘id’, adId); } tempSlot.defineSizeMapping(adSizeMapping).addService(googletag.pubads()).setTargeting(“pos”, gptPOS); if (gptTC !== ”) { tempSlot.setTargeting(“tc”, gptTC); } if (gptNative !== ”) { tempSlot.setTargeting(“native”, gptNative); } gptEvent_Debug = gptEvent_Debug + $(this).data(‘adsize’) + ‘ Requested
‘; } else { gptInvalidAdSize_Debug = gptInvalidAdSize_Debug + “Invalid Size Found, Id: ” + $(this).prop(‘id’) + ‘, adSize: ‘ + $(this).data(‘adsize’) + ‘
‘; $(this).remove(); } }); if (gpt_CheckForNULL(gptInvalidAdSize_Debug) === null) { gptInvalidAdSize_Debug = “None Detected”; } //*********************************************** //End detection for ad slots on page //*********************************************** //*********************************************** //Start page level targeting //*********************************************** if (gpt_AdFile !== ‘PU’) { //Logged in or IP Access gpt_TargetAccessType(); //Check for Screenshot Client gpt_CheckSSC(); } //Check for DFP Test gpt_GetDFPTestId(); //Check for Additional Targeting gpt_GetAdditionalTargeting(); if (gpt_IsProd && gptContextualEnabled) { var gpt_ContextualRetry = false; //Check for Contextual Targeting if (gs_channels !== “DEFAULT”) { var gpt_ContextualCategories = Array.from(gs_channels); for (var i = 0; i < gpt_ContextualCategories.length; i++) { if (gpt_ContextualCategories[i] == 'gx_retry') { gpt_ContextualRetry = true; } if (!gpt_ContextualCategories[i].startsWith("custom_")) { //Remove any tag that is not custom gpt_ContextualCategories.splice(i, 1); i--; } else { //Strip the 'custom_' from the tag gpt_ContextualCategories[i] = gpt_ContextualCategories[i].replace("custom_", "") } } if (gpt_ContextualCategories.length > 0) { googletag.pubads().setTargeting(“gs_cat”, gpt_ContextualCategories); } else { gpt_ContextualCategories = ‘none’; } if (gpt_ContextualRetry) { gpt_ContextualCategories = “*Indexing*”; } gptContextualResult_Debug = gpt_ContextualCategories; } else { gptContextualResult_Debug = ‘No segments found’; } } else { //Not Prod gptContextualResult_Debug = ‘Not enabled’; var gpt_DevSite = gpt_CheckForNULL($(‘#gptSite’).val(), “dev”); $(‘#gpt-Variables’).append(”); gpt_Target(“Environment”); } //*********************************************** //End page level targeting //*********************************************** //Enable google dfp services if (parseInt($(‘#gptLazyLoading’).val()) === 1) { googletag.pubads().enableLazyLoad({ fetchMarginPercent: 200, renderMarginPercent: 0, mobileScaling: 2.0 }); } else { googletag.pubads().enableSingleRequest(); } //Add Listener for RenderEnded googletag.pubads().addEventListener(‘slotRenderEnded’, function (event) { if (!event.isEmpty) { if (typeof LocalAdLoaded === “function”) { LocalAdLoaded(event); } if (gpt_ResponsiveHomepage) { if (typeof positionAd === “function”) { positionAd(); } } if (event.size[0] == “480” || event.size[1] == “480”) { $(‘.gpt-InScrollBox’).css(‘display’, ‘block’); gptEvent_Debug = gptEvent_Debug + ‘Interscroller ‘ + event.size + ‘ rendered: ‘ + gpt_GetElapsedTime() + ‘
‘; } else { gptEvent_Debug = gptEvent_Debug + event.size + ‘ rendered: ‘ + gpt_GetElapsedTime() + ‘
‘; } } }); if (gpt_AdFile !== ‘PU’) { googletag.pubads().collapseEmptyDivs(); } googletag.enableServices(); //Populate Defined Ad Slots $(“.gpt-ad-defined”).each(function (index) { var adId = $(this).attr(‘id’); googletag.cmd.push(function () { googletag.display(adId); }); }); gptStatus_Debug = ‘GPT Complete’; }); } //————————————————————————– function gpt_DisplayDebug() { //Clone the template and append to Body $(document.body).append($(‘#gpt-DebugDiv’).clone()); $(‘#gpt-DebugDiv’).remove(); //Populate the Values gpt_LoadDebugValues(); //Display and scroll to debug section $(‘.gpt-DebugDiv’).css(‘display’, ‘block’); window.scrollTo(0, document.body.scrollHeight); } //————————————————————————– function gpt_LoadDebugValues() { $(‘.gpt-DebugBtn’).blur(); $(‘.gptVersion_Debug’).text(gpt_Version); $(‘.gptAdFile_Debug’).html(gpt_AdFile); $(‘.gptEvent_Debug’).html(gptEvent_Debug); $(‘.gptCustomTargeting_Debug’).html(gptCustomTargeting_Debug); $(‘.gptSite_Debug’).text(gptSite_Debug); $(‘.gptContextualResult_Debug’).text(gptContextualResult_Debug); $(‘.gptContextualInit_Debug’).text(gptContextualInit_Debug); $(‘.gptContextualURL_Debug’).text(gptContextualURL_Debug); $(‘.gptContextualReady_Debug’).text(gptContextualReady_Debug); $(‘.gptMoatReady_Debug’).text(gptMoatReady_Debug); $(‘.gptMoatInit_Debug’).text(gptMoatInit_Debug); $(‘.gptTestENV_Debug’).text(gptTestENV_Debug); $(‘.gptDisableAds_Debug’).text(gptDisableAds_Debug); $(‘.gptStatus_Debug’).text(gptStatus_Debug); $(‘.gptPage_Debug’).text(gptPage_Debug); $(‘.gptInvalidAdSize_Debug’).html(gptInvalidAdSize_Debug); } //————————————————————————– function gpt_GrapeShotDebug() { $(‘.gpt-DebugBtn’).blur(); window.open(“http://admin-elsevier.grapeshot.co.uk/custom/bookmarklet.cgi?blocking=1&vn=2&url=” + encodeURIComponent(document.location), “GRAPESHOT_POPUP”, “width=650,height=600,scrollbars=yes,screenX=40,screenY=50,menubar=no,toolbar=no,resizable=yes”, “Custom”).focus(); } //————————————————————————– function gpt_ShowConsole() { $(‘.gpt-DebugBtn’).blur(); googletag.openConsole(); } //————————————————————————–

Source