Live Blog, Comments, Story and Web Story can leave empty ad slots between their items. UniSignIn doesn't serve ads itself: your ad stack fills the slots.
ad_slots event and fill the slots it gives you, see Use your own ad server.Readers with an ad-free experience, and pages marked as no-ads pages, get no slots.
Add these attributes to the widget's container:
| Attribute | Description |
|---|---|
data-ad-start | A slot after this many items. For example, 3 puts the first slot after the 3rd item. |
data-ad-interval | Then a slot every this many items. For example, 5 adds a slot every 5 items after the first one. Required for Live Blog; for the other widgets, leave it out for a single slot. |
For example, a slot after the 3rd comment, then after every 5 more:
<div data-exp="unis-comment" data-exp-id="EXPERIENCE_ID" data-ad-start="3" data-ad-interval="5"></div>
| Widget | Slots go | Without the attributes |
|---|---|---|
| Live Blog | between posts | no slots |
| Comments | between comments, under each top-level comment | no slots |
| Story | between cards in the row | the experience's Ad slot setting |
| Web Story | between stories in the player | the experience's Ad slot setting |
Each slot is an empty <div> with a class for its widget and data-ad-slot set to its number:
| Widget | Slot class |
|---|---|
| Live Blog | unis-liveblog-ai-mpu |
| Comments | unis-comment-ai-mpu |
| Story | unis-story-mpu |
| Web Story | unis-webstory-mpu |
Ask your BiddingStack contact to set up an ad unit for each class you use. Whenever new slots appear, for example when a reader loads more comments, the widget asks BiddingStack to fill them.
Whenever new slots appear, the widget sends an ad_slots event with the new slot elements. Each slot is sent once, so loading more posts or comments only sends the slots that were added. The event waits until your page listens for it, so your script can load after the widgets.
window.unisignin = window.unisignin || {}
window.unisignin.cmd = window.unisignin.cmd || []
window.unisignin.cmd.push(['register_event', 'ad_slots', function (event) {
// event.widget: 'liveblog', 'comment', 'story' or 'webstory'
// event.slots: the new slot elements
event.slots.forEach(function (slot) {
// fill the slot with your ad server
})
}])
For example, with Google Ad Manager. Give each slot an ID first, as Google Ad Manager needs one:
var unisAdCount = 0
window.unisignin.cmd.push(['register_event', 'ad_slots', function (event) {
event.slots.forEach(function (slot) {
if (!slot.id) slot.id = 'unis-ad-' + ++unisAdCount
googletag.cmd.push(function () {
googletag.defineSlot('/1234567/in_feed', [300, 250], slot.id).addService(googletag.pubads())
googletag.display(slot.id)
})
})
}])
Replace /1234567/in_feed and the size with your own ad unit. If BiddingStack is also on the page, it is still asked to fill the slots, so fill only the slots BiddingStack doesn't.
Identity, consent, audience, and subscription insights for publishers. A few emails a month, no spam.