Docs

Install the mpwa Ads SDK

Three lines of HTML get a publisher serving ads. Bundlers, CMP, Prebid, and mobile SDKs follow the same versioned URL pattern (/sdk/v1/).

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)

index.html
<!-- 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.

app.js
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,
});

Consent management (CMP)

A standalone ~12 KB banner that records consent into TCF 2.2 + GPP strings and propagates them to the SDK. AR/EN out of the box.

<head>
<!-- TCF 2.2 + GPP consent banner (~12 KB minified). -->
<script async src="https://mpwa.to/sdk/v1/cmp.min.js" data-site-id="YOUR_SITE_ID"></script>

Prebid.js bid adapter

Already running Prebid? Add our adapter, register an ad unit, and we'll bid alongside your other demand partners.

prebid-config.js
import { mpwaBidAdapter } from 'https://mpwa.to/sdk/v1/mpwa-prebid.esm.js';

pbjs.que.push(function () {
  pbjs.registerBidAdapter(mpwaBidAdapter);
  pbjs.addAdUnits([
    {
      code: 'div-728x90',
      mediaTypes: { banner: { sizes: [[728, 90]] } },
      bids: [{ bidder: 'mpwa', params: { adUnitId: 'YOUR_AD_UNIT_ID' } }],
    },
  ]);
});

Mobile SDKs

Native sources live in the monorepo while we finish Maven Central + CocoaPods publishing. Pinned source URLs work today.

iOS — Swift Package Manager

Package.swift
// Package.swift
.package(url: "https://github.com/mpwa/ad-platform.git", from: "0.1.0"),

// In your target dependencies:
.product(name: "MpwaAds", package: "ad-platform")
ViewController.swift
import MpwaAds

let client = MpwaAds.shared
client.configure(publisherId: "YOUR_PUBLISHER_ID")

let banner = BannerAdView(adUnitId: "YOUR_AD_UNIT_ID", size: .init(width: 320, height: 50))
view.addSubview(banner)
banner.load()

Android — Gradle (Kotlin DSL)

build.gradle.kts
// settings.gradle.kts — until we publish to Maven Central, point at the
// monorepo as a Git source via Composing or as a local AAR.
implementation("to.mpwa:mpwa-ads:0.1.0")
MainActivity.kt
import to.mpwa.ads.MpwaAds
import to.mpwa.ads.BannerAdView

MpwaAds.init(this, publisherId = "YOUR_PUBLISHER_ID")

val banner = BannerAdView(this).apply {
  adUnitId = "YOUR_AD_UNIT_ID"
  size = AdSize(320, 50)
}
container.addView(banner)
banner.load()

Flutter

pubspec.yaml
dependencies:
  mpwa_ads:
    git:
      url: https://github.com/mpwa/ad-platform.git
      path: sdks/flutter

React Native

terminal
npm install github:mpwa/ad-platform#main --workspace sdks/react-native

What you're loading

Every file is served from mpwa.to with a 1-year immutable cache header. Major versions bump the path (/sdk/v2/).

Cache-Control: public, max-age=31536000, immutable · CORS open · CRP cross-origin.