You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, thank you for your great module. I couldn't have finished my project without it.
When creating ads on infinite scroll screen, I had to use same ad units in Google Ad Manager.
if (onSlotRenderEnded) {
googletag.cmd.push(() => {
googletag.pubads().addEventListener('slotRenderEnded', (event) => {
// check if the current slot is the one the callback was added to
// (as addEventListener is global)
if (event.slot.getAdUnitPath() === path) {
onSlotRenderEnded(event);
}
});
});
}
Above code only check the path of the ad unit, so I added && statement to validate the slotElementId.
// Execute callback when the slot is visible in DOM (thrown before 'impressionViewable' )
if (onSlotRenderEnded) {
googletag.cmd.push(() => {
googletag.pubads().addEventListener('slotRenderEnded', (event) => {
// check if the current slot is the one the callback was added to
// (as addEventListener is global)
if (event.slot.getAdUnitPath() === path && event.slot.getSlotElementId() === id) {
onSlotRenderEnded(event);
}
});
});
}
Also, when the Ad component unmounts, the event handler do not get removed. So it would be a good idea to remove the event handler in componentWillUnmount.
The text was updated successfully, but these errors were encountered:
First of all, thank you for your great module. I couldn't have finished my project without it.
When creating ads on infinite scroll screen, I had to use same ad units in Google Ad Manager.
Above code only check the path of the ad unit, so I added && statement to validate the slotElementId.
Also, when the Ad component unmounts, the event handler do not get removed. So it would be a good idea to remove the event handler in componentWillUnmount.
The text was updated successfully, but these errors were encountered: