ES6 Publisher Mode Demo: lovelybooks

This page contains the complete ad configuration


🔧 Integration

This code should be placed in the head of your page

<link rel="preconnect" href="https://securepubads.g.doubleclick.net" crossorigin="anonymous">
<link rel="preconnect" href="[[domain]]" crossorigin="anonymous">

<!-- sourcepoint CMP (required) -->
<script>
  !function () { var e = function () { var e, t = "__tcfapiLocator", a = [], n = window; for (; n;) { try { if (n.frames[t]) { e = n; break } } catch (e) { } if (n === window.top) break; n = n.parent } e || (!function e() { var a = n.document, r = !!n.frames[t]; if (!r) if (a.body) { var i = a.createElement("iframe"); i.style.cssText = "display:none", i.name = t, a.body.appendChild(i) } else setTimeout(e, 5); return !r }(), n.__tcfapi = function () { for (var e, t = arguments.length, n = new Array(t), r = 0; r < t; r++)n[r] = arguments[r]; if (!n.length) return a; if ("setGdprApplies" === n[0]) n.length > 3 && 2 === parseInt(n[1], 10) && "boolean" == typeof n[3] && (e = n[3], "function" == typeof n[2] && n[2]("set", !0)); else if ("ping" === n[0]) { var i = { gdprApplies: e, cmpLoaded: !1, cmpStatus: "stub" }; "function" == typeof n[2] && n[2](i) } else a.push(n) }, n.addEventListener("message", (function (e) { var t = "string" == typeof e.data, a = {}; try { a = t ? JSON.parse(e.data) : e.data } catch (e) { } var n = a.__tcfapiCall; n && window.__tcfapi(n.command, n.version, (function (a, r) { var i = { __tcfapiReturn: { returnValue: a, success: r, callId: n.callId } }; t && (i = JSON.stringify(i)), e.source.postMessage(i, "*") }), n.parameter) }), !1)) }; "undefined" != typeof module ? module.exports = e : e() }();
</script>
<script>
window._sp_ = {
    config: {
        accountId: 270,
        baseEndpoint: 'https://consent.lovelybooks.de',
        isSPA: true
    }
}
</script>
<script async src="https://consent.lovelybooks.de/wrapperMessagingWithoutDetection.js" onload="window._sp_.executeMessaging()"></script>

<!-- your ad tag -->
<script async type="module" src="[[domain]]moli_abc9457137ca51ff7ef8.min.mjs"></script>

You can find more information about the configuration of the tag in our Api Docs.

🦄 Single Page Application

The initial page should contain this javascript code to request ads for the first page view.

<script>
// initialize the command queue
window.moli = window.moli || { que: [] };
window.moli.que.push(function(moliAdTag) {

    // refresh ad slots - either a single ad slot or an array of ad slots
    moliAdTag.refreshAdSlot('h5v_marginal_top');
    moliAdTag.refreshAdSlot([
        'h5v_content_rezi_1',
        'h5v_content_rezi_2',
        'h5v_content_top',
        'h5v_content_row_1',
        'h5v_content_row_2'
    ]);
    moliAdTag.refreshAdSlot('h5v_sticky_1');
    moliAdTag.refreshAdSlot('h5v_sticky_bottom');
    moliAdTag.refreshAdSlot([
        'LB_Bestseller_Genre_dfp',
        'LB_Bestseller_Ausgeloggte_Home_dfp',
        'LB_Bestseller_Autor_dfp',
        'LB_Bestseller_Buch_dfp',
        'LB_Bestseller_Listen_mobil',
        'LB_Bestseller_Reihe_dfp',
        'LB_Bestseller_Liste_Detail_dfp',
        'LB_Bestseller_Liste_Alle_dfp',
        'LB_Bestseller_Liste_Kategorie_dfp'
    ]);

    // trigger ads
    moliAdTag.requestAds();
});
</script>

This snippet needs to be executed each time the user navigates to a new page.

<script>
// initialize the command queue
window.moli = window.moli || { que: [] };
window.moli.que.push(function(moliAdTag) {
    // refresh ads
    moliAdTag.requestAds();
});
</script>

🧾 Sourcepoint CMP

Basic setup documentation

Single Page Application

The sourcepoint script supports single page applications with the

isSPA: true
parameter. This adds a new function to the global sourcepoint object
window._sp_.executeMessaging()
This method must be triggered
  1. on the first page load. We recommend to add it to the onload callback on the sourcepoint script
    <script async src="https://consent.lovelybooks.de/wrapperMessagingWithoutDetection.js" onload="window._sp_.executeMessaging()"></script>
  2. on each navigation change

Footer link for the privacy modal

TCF 2 and german law require the privacy settings to be accessible at all times. A clean way to do this is to add a link into the footer that opens the privacy manager.

Privacy Settings

<a href="#" onclick="window._sp_.loadPrivacyManagerModal(186157);">Privatsphäre></a> 

Privacy Page

Additionally to sourcepoint scripts integrated in the head of your page, place this button on your privacy page to open the privacy manager

<button type="button" onclick="window._sp_.loadPrivacyManagerModal(186157);">Datenschutz Einstellungen öffnen></button>

🔮 Moli Console

You can get more details by opening the moli console.

Or if you are developer type this into the javascript console

moli.openConsole()

🚧 Ad Slots

h5v_marginal_top (lb_marginal)

window.moli = window.moli || { que: [] };
window.moli.que.push(function(moliAdTag) {
  moliAdTag.refreshAdSlot('ads.h5v_marginal_top'');
});


h5v_content_rezi_1 (lb_content_1)

window.moli = window.moli || { que: [] };
window.moli.que.push(function(moliAdTag) {
  moliAdTag.refreshAdSlot('ads.h5v_content_rezi_1'');
});


h5v_content_rezi_2 (lb_content_2)

window.moli = window.moli || { que: [] };
window.moli.que.push(function(moliAdTag) {
  moliAdTag.refreshAdSlot('ads.h5v_content_rezi_2'');
});


h5v_sticky_1 (lb_sidebar)

window.moli = window.moli || { que: [] };
window.moli.que.push(function(moliAdTag) {
  moliAdTag.refreshAdSlot('ads.h5v_sticky_1'');
});


h5v_sticky_bottom (lb_mobile_stickyad)

window.moli = window.moli || { que: [] };
window.moli.que.push(function(moliAdTag) {
  moliAdTag.refreshAdSlot('ads.h5v_sticky_bottom'');
});


h5v_content_top (lb_content_3)

window.moli = window.moli || { que: [] };
window.moli.que.push(function(moliAdTag) {
  moliAdTag.refreshAdSlot('ads.h5v_content_top'');
});


h5v_content_row_1 (lb_content_4)

window.moli = window.moli || { que: [] };
window.moli.que.push(function(moliAdTag) {
  moliAdTag.refreshAdSlot('ads.h5v_content_row_1'');
});


h5v_content_row_2 (lb_content_5)

window.moli = window.moli || { que: [] };
window.moli.que.push(function(moliAdTag) {
  moliAdTag.refreshAdSlot('ads.h5v_content_row_2'');
});


🥰 📚 Ad Slots

LB_Bestseller_Buch_dfp

window.moli = window.moli || { que: [] };
window.moli.que.push(function(moliAdTag) {
  moliAdTag.refreshAdSlot('ads.LB_Bestseller_Buch_dfp'');
});


LB_Bestseller_Ausgeloggte_Home_dfp

window.moli = window.moli || { que: [] };
window.moli.que.push(function(moliAdTag) {
  moliAdTag.refreshAdSlot('ads.LB_Bestseller_Ausgeloggte_Home_dfp'');
});


LB_Bestseller_Autor_dfp

window.moli = window.moli || { que: [] };
window.moli.que.push(function(moliAdTag) {
  moliAdTag.refreshAdSlot('ads.LB_Bestseller_Autor_dfp'');
});


LB_Bestseller_Genre_dfp

window.moli = window.moli || { que: [] };
window.moli.que.push(function(moliAdTag) {
  moliAdTag.refreshAdSlot('ads.LB_Bestseller_Genre_dfp'');
});


LB_Bestseller_Listen_mobil

window.moli = window.moli || { que: [] };
window.moli.que.push(function(moliAdTag) {
  moliAdTag.refreshAdSlot('ads.LB_Bestseller_Listen_mobil'');
});


LB_Bestseller_Reihe_dfp

window.moli = window.moli || { que: [] };
window.moli.que.push(function(moliAdTag) {
  moliAdTag.refreshAdSlot('ads.LB_Bestseller_Reihe_dfp'');
});


LB_Leserpreis_Subnavi_dfp

window.moli = window.moli || { que: [] };
window.moli.que.push(function(moliAdTag) {
  moliAdTag.refreshAdSlot('ads.LB_Leserpreis_Subnavi_dfp'');
});


LB_Bestseller_Liste_Detail_dfp

window.moli = window.moli || { que: [] };
window.moli.que.push(function(moliAdTag) {
  moliAdTag.refreshAdSlot('ads.LB_Bestseller_Liste_Detail_dfp'');
});


LB_Bestseller_Liste_Alle_dfp

window.moli = window.moli || { que: [] };
window.moli.que.push(function(moliAdTag) {
  moliAdTag.refreshAdSlot('ads.LB_Bestseller_Liste_Alle_dfp'');
});


LB_Bestseller_Liste_Kategorie_dfp

window.moli = window.moli || { que: [] };
window.moli.que.push(function(moliAdTag) {
  moliAdTag.refreshAdSlot('ads.LB_Bestseller_Liste_Kategorie_dfp');
});