import getParameterByName from './getParameterByName'; import Ias from './ias'; const ONETRUST_LOGS = 'ot_logs'; const ONETRUST_GEOLOCATION_MOCK = 'ot_geolocation_mock'; const ONETRUST_SCRIPT_ID = '38cb75bd-fbe1-4ac8-b4af-e531ab368caf-test'; export const loadBootstrap = () => { const freestar = (window).freestar || {}; freestar.queue = freestar.queue || []; freestar.config = freestar.config || {}; freestar.config.enabled_slots = []; freestar.initCallback = function() { freestar.config.enabled_slots.length === 0 ? (freestar.initCallbackCalled = false) : freestar.newAdSlots(freestar.config.enabled_slots); }; // Ask Rachel freestar.config.channel = '/4735792/reuters.com/home'; (window).initBootstrap( { onetrust_logs: getParameterByName(ONETRUST_LOGS) || 'false', geolocation_mock: getParameterByName(ONETRUST_GEOLOCATION_MOCK) || 'default', onetrust_script_id: ONETRUST_SCRIPT_ID, }, (onetrustResponse) => { const iasPromise = Ias(); // Ask Thea about Permutive implementation (considering there are no logged in users on Graphics) // Should we use Permutive at all? // Should we import ArcP SDK to graphics to get the same user as logged in on RCom? return Promise.all([iasPromise]).then((responses) => { const [iasResponse] = responses; return { ...onetrustResponse, ias: iasResponse, }; }); } ); (window).bootstrap.getResults((result) => { // Set GAM (window).googletag = (window).googletag || { cmd: [] }; (window).googletag.cmd.push(() => { (window).googletag.pubads().enableSingleRequest(); (window).googletag.pubads().enableAsyncRendering(); (window).googletag.pubads().collapseEmptyDivs(true); // Global Ads test targeting const adstest = new URL(document.location.href).searchParams.get('adstest'); if (adstest) { (window).googletag.pubads().setTargeting('adstest', adstest); } // Ask Rachel about targeting const template = (document.querySelector('meta[name="ad:template"]'))?.content; if (template) { (window).googletag.pubads().setTargeting('template', template); } }); if (!Array.isArray((window).graphicsAdQueue)) { console.error('Ad queue not initialized!'); } freestar.queue.push(function() { freestar.newAdSlots((window).graphicsAdQueue || [], 'foobar'); }); freestar.queue.push(function() { (window).googletag.pubads().set('page_url', 'https://www.reuters.com/'); // This line should only be used for testing }); }); };