Tài liệu

Hỗ trợ

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
    <script src="mraid.js"></script>
    tag within the
    <head>
    section of the HTML file.
  • This ensures the
    mraid.js
    script is requested as early as possible during ad creative loading.

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
      ready
      event fired by the host (
      adplayer
      ).
    • Apply relevant event listeners:
      • Volume control based on
        audioVolumeChange
        events.
      • Show ad once
        viewableChange
        is true for the first time.
    • Click-through behavior: Use
      mraid.open(URL_STRING)
      with your app store URL to redirect users.
    • 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:// |

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>