Web — JS SDK
Drop the <script> on any page, place a slot wherever you want the ad, initialise with your publisher id.
Quick start (3 lines)
<!-- 1. Load the SDK once per page. -->
<script async src="https://mpwa.to/sdk/v1/sdk.min.js"></script>
<!-- 2. Drop an ad slot anywhere in your markup. -->
<div data-ad-unit="YOUR_AD_UNIT_ID" data-size="728x90"></div>
<!-- 3. Initialise with your publisher id. Slots auto-fill. -->
<script>
window.addEventListener('DOMContentLoaded', function () {
MpwaAds.init({ publisherId: 'YOUR_PUBLISHER_ID' });
});
</script>Using a bundler? Import the ESM build
The ESM build is tree-shakeable. Import only what you use; the rest of the bundle disappears in production.
import { init } from 'https://mpwa.to/sdk/v1/sdk.esm.js';
init({
publisherId: 'YOUR_PUBLISHER_ID',
adServerUrl: 'https://ads.mpwa.to', // optional override
debug: false,
});