MRAID Ads Requirements
Impression Tracking with MRAID Creative
To track impressions inside the creative, include a script that triggers impression trackers on the viewableChange
event:
<script src="mraid.js"></script>
<script type="application/javascript">
// Wait for the SDK to become ready
function onSdkReady() {
// Wait for the ad to become viewable for the first time
if (mraid.isViewable()) {
showMyAd();
} else {
mraid.addEventListener('viewableChange', function(viewable) {
if (viewable) {
mraid.removeEventListener('viewableChange', arguments.callee);
showMyAd();
}
});
}
}
if (mraid.getState() === 'loading') {
mraid.addEventListener('ready', onSdkReady);
} else {
onSdkReady();
}
function showMyAd() {
sendImpressionTrackers();
// ...
}
</script>
warning
If you are using impression pixels in the creative, move them to seatbid.bid.ext.imptrackers
(the Bid object) or trigger them within the viewableChange
event.