Skip to content

Commit

Permalink
test: delay prebid
Browse files Browse the repository at this point in the history
  • Loading branch information
fkakatie committed Sep 12, 2022
1 parent e8bf05d commit 60d881b
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 38 deletions.
28 changes: 0 additions & 28 deletions head.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,3 @@
<script src="/scripts/scripts.js" type="module" crossorigin="use-credentials"></script>
<link rel="stylesheet" href="/styles/styles.css" />
<link rel="icon" href="data:,">

<link rel="preload" as="script" href='https://www.googletagservices.com/tag/js/gpt.js' />
<link rel="preload" as="script" href='https://web.prebidwrapper.com/et-DAz5JreYZr/default/prebid-load.js' />
<link rel="preload" as="script" href='https://web.prebidwrapper.com/et-DAz5JreYZr/default/prebid-library.js' />
<link rel="preload" as="script" href='https://web.prebidwrapper.com/et-DAz5JreYZr/default/prebid-wrapper.js' />

<script>
var tude = window.tude || { cmd: [] };
tude.cmd.push(function() {
// tude.setDeviceType('mobile'); // optional: mobile, tablet, desktop
tude.setPageTargeting({ // optional
et_uid: '/dpworld-tour/schedule/',
et_platform: 'web',
et_environment: 'stg',
et_slug: '',
et_player: 'bob-barker',
et_language: 'en-gb',
et_main_tour: 'dpworldtour',
et_L2: 'schedule',
et_L3: 'index',
et_event: 'british-masters-2022',
et_edt_content_type: 'Callaway',
et_appsection: '',
});
tude.setAdUnitPath('/9517547/ET/web'); // or whatever you want to set the ad unit of all ads on the page to be
});
</script>
<script async src="https://web.prebidwrapper.com/et-DAz5JreYZr/default/prebid-load.js"></script>
33 changes: 23 additions & 10 deletions scripts/delayed.js
Original file line number Diff line number Diff line change
Expand Up @@ -518,16 +518,29 @@ const cookieScript = loadScript('https://cdn.cookielaw.org/scripttemplates/otSDK
cookieScript.setAttribute('data-domain-script', '262c6c79-a114-41f0-9c07-52cb1fb7390c');

function loadAds() {
// eslint-disable-next-line no-var
var tude = window.tude || { cmd: [] };
// eslint-disable-next-line prefer-arrow-callback
tude.cmd.push(function () {
tude.refreshAdsViaDivMappings([
{
divId: 'pb-slot-content-1',
baseDivId: 'pb-slot-content-1',
},
]);
window.tude = window.tude || { cmd: [] };
loadScript('https://www.googletagservices.com/tag/js/gpt.js', () => {
loadScript('https://web.prebidwrapper.com/et-DAz5JreYZr/default/prebid-load.js', () => {
loadScript('https://web.prebidwrapper.com/et-DAz5JreYZr/default/prebid-library.js', () => {
loadScript('https://web.prebidwrapper.com/et-DAz5JreYZr/default/prebid-wrapper.js', () => {
window.tude.cmd.push(() => {
window.tude.setPageTargeting({ // optional
et_platform: 'web',
});
window.tude.setAdUnitPath('/9517547/ET/web'); // or whatever you want to set the ad unit of all ads on the page to be
});
window.tude.cmd.push(() => {
[...document.querySelectorAll('.ad')].forEach((ad) => {
const slot = ad.getAttribute('data-slot');
window.tude.refreshAdsViaDivMappings([{
divId: slot,
baseDivId: slot,
}]);
});
});
});
});
});
});
}

Expand Down
1 change: 1 addition & 0 deletions scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,7 @@ async function preloadAdPlaceholders(doc) {
if (placements[position]) {
const pos = placements[position];
const placeholder = document.createElement('aside');
placeholder.setAttribute('data-slot', pos.slot);
placeholder.className = `ad ad-${toClassName(position)}`;
placeholder.innerHTML = `<div id="${pos.slot}"></div>`;
if (pos.insertAfter) {
Expand Down
26 changes: 26 additions & 0 deletions styles/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,32 @@ main .section.teaser picture.section-background img {
}
}

/* ads */
.ad {
box-sizing: border-box;
align-items: center;
justify-content: center;
}

.ad.ad-top {
display: none;
visibility: hidden;
min-height: 90px;
margin: 32px 0;
}

@media (min-width: 980px) {
.ad.ad-top {
display: flex;
visibility: visible;
}
}

.ad > div {
max-width: 100%;
overflow-x: hidden;
}

/* icons */
.icon[class*=icon-flag-] svg {
fill: #000;
Expand Down

0 comments on commit 60d881b

Please sign in to comment.