Libraries
SDKs and libraries
Every official SDK is at v0.4.0 and speaks the same edge contract (/v1/serve, /v1/track, /v1/features). Publishable keys (pk_) drive delivery from the client; secret keys (sk_) are only needed for /v1/audio/stitch and /v1/email/prepare.
Pick a runtime
All four client SDKs expose the same shape: initialize once with a publishable key, then render a slot. Server-to-server callers can skip the SDK and hit the REST edge directly.
Web · @adpluga/web
Ships as a native custom element (<adpluga-ad>) plus an ES module for full control. IntersectionObserver-driven lazy load, single-fire impression beacon, click tracker with signed redirect. Zero runtime deps.
Install
npm install @adpluga/web@0.4.0Minimal usage
<script type="module" src="https://cdn.adpluga.com/v1/adpluga.js"></script>
<adpluga-ad
publisher-key="pk_test_•••"
slot-id="slot_home_top"
format="banner_300x250"
lazy></adpluga-ad>- Framework-agnostic — works with React, Vue, Svelte, Astro, plain HTML.
- Lazy loads via IntersectionObserver; only fetches when the slot enters the viewport.
- Impression fires once per element instance; click uses the signed edge redirect.
- Typed ES module (initialize, serve, track) when you need a custom render.
Flutter · adpluga_flutter
AdPlugaBanner widget for the common case; low-level AdPlugaVideo and AdPlugaHtml primitives when you need to compose your own render. Consent, logger and error stream are all top-level APIs.
Install
dependencies:
adpluga_flutter: ^0.4.0Minimal usage
import 'package:flutter/material.dart';
import 'package:adpluga_flutter/adpluga_flutter.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await AdPluga.initialize(publisherKey: 'pk_test_•••');
runApp(const MyApp());
}- AdPlugaBanner covers standard slot rendering with impression/click/error callbacks.
- Sealed AdPlugaError hierarchy — pattern-match instead of parsing message strings.
- setLoggerEnabled/setLoggerSink at package level for structured debug output.
- Consent state (LGPD/GDPR/COPPA) forwarded to every serve call automatically.
Android · com.adpluga:adpluga
AdView with a single load(slotId, format?, listener?) call. AdPluga.initialize takes just the publisher key — no Context required. Event stream via SdkEvent sealed class; debug output via AdPlugaLogger.enabled.
Install
dependencies {
implementation("com.adpluga:adpluga:0.4.0")
}Minimal usage
class AdPlugaApp : Application() {
override fun onCreate() {
super.onCreate()
AdPluga.initialize(publisherKey = "pk_test_•••")
}
}- One-line init: AdPluga.initialize(publisherKey = "pk_...").
- AdView.load reports Impression, Click and Error via AdListener.
- Coroutine-friendly — every SDK entry point suspends without blocking the UI thread.
- AdPlugaLogger.enabled = true prints structured lifecycle events under the AdPluga tag.
iOS · AdPluga (SPM)
AdPluga.initialize is a throwing init; AdPlugaView(frame:) + load(slotId:format:) mounts a banner. Delegate methods use the underscored view parameter convention. Wrap AdPlugaView in UIViewRepresentable for SwiftUI.
Install
dependencies: [
.package(
url: "https://github.com/adpluga/adpluga-ios.git",
from: "0.4.0"
),
]Minimal usage
import AdPluga
func application(
_ app: UIApplication,
didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
_ = try? AdPluga.initialize(publisherKey: "pk_test_•••")
return true
}- Throwing initialize catches malformed keys at boot instead of at first render.
- AdPlugaViewDelegate reports willPresent, didLoad, didClick and didFail(_:error:).
- Sendable-friendly — safe to call load(slotId:) from any actor.
- AdPlugaLogger.enabled = true streams os_log lifecycle events for Instruments.
Server-to-server
Skip the SDK when you render server-side (email HTML, native app backends, AMP, CTV). Call the edge directly with a publishable key — the same contract every client SDK uses under the hood. Return 204 means no fill; treat it as a no-ad, not an error.
curl "https://edge.adpluga.com/v1/serve?slot=slot_home_top" \
-H "X-AdPluga-Key: pk_live_•••"- Stateless — GET /v1/serve, no session cookies, no CORS preflight.
- 204 No Content on empty fills — never returns a fabricated placeholder.
- Signed impression_url / click_url — safe to embed in third-party pages.
- Server-only endpoints (/v1/audio/stitch, /v1/email/prepare) use sk_ via Authorization: Bearer.
OpenAPI clients
Every endpoint is documented in api/openapi.yaml. Generate a typed client with openapi-generator or orval — the spec is validated on every release and matches production 1:1.