MRAID requirements
Adhere to MRAID (Mobile Rich Media Ad Interface Definitions) standards when creating and uploading mobile ad creatives.
Thời gian đọc 1 phútCập nhật lần cuối 3 ngày trước
MRAID is the industry standard protocol API for mobile rich media ads running in mobile apps. It is injected by the ironSource Ads webview, allowing you to use MRAID methods as detailed in the guidelines. To learn more, review the IAB’s documentation for detailed information on MRAID 3.0 methods, best practices, and standards.
MRAID Related Requirements
- Your creative file must not include any reference to the "DAPI initialization script" (the deprecated iAds communication protocol) or to DAPI in general, as this may disrupt the upload process.
- Creatives should be contained in a single HTML index file, with no links to other files or folders.
Bootstrapping
Request MRAID service
- Include the tag within the
<script src="mraid.js"></script>section of the HTML file.<head> - This ensures the script is requested as early as possible during ad creative loading.
mraid.js
Service readiness
- Creatives are required to wait for the MRAID ready and stateChange events before starting playable content.
- Wait for service readiness:
- Wait for the event fired by the host (
ready).adplayer - Apply relevant event listeners:
- Volume control based on events.
audioVolumeChange - Show ad once is true for the first time.
viewableChange
- Volume control based on
- Click-through behavior: Use with your app store URL to redirect users.
mraid.open(URL_STRING) - Do not use automatic redirection; opening store URLs should be user-initiated.
- Avoid accessing top window object (may cause errors).
- All URLs within creatives should be secured: | Correct | Wrong | |----------|---------| | HTTPS:// | HTTP:// |
- Wait for the
Example Script
<script>// Wait for the MRAID service to become readyif (mraid.getState() === 'loading') { mraid.addEventListener('ready', onSdkReady);} else { onSdkReady();}function onSdkReady() { // Required listeners mraid.addEventListener('stateChange', stateChangeHandler); mraid.addEventListener('viewableChange', viewableChangeHandler); mraid.addEventListener('audioVolumeChange', audioVolumeChangeHandler); if (mraid.getViewable && mraid.getViewable()) { maybeStart(); }}var started = false;function maybeStart() { if (started) return; started = true; startPlayable();}function viewableChangeHandler(isViewable) { if (isViewable) { maybeStart(); } else { pausePlayable(); }}function audioVolumeChangeHandler(vol) { if (vol === 0) { setAudioMuted(true); } else { setAudioVolume(vol); }}...</script>