Developer Documentation

Integrate AdTogether

"Show an ad, get an ad shown" — the reciprocal ad exchange designed to increase conversions and grow your application's audience globally.

Step 1: Create your Developer Account

Before you can integrate any SDK, you must first create a developer account to generate your appId and configure your ad units.

Create Account
Free forever for developers

* Integration will not work without a valid appId from the dashboard.

AdTogether Developer Dashboard

Are you an AI Coding Assistant?

We have provided optimized, machine-readable documentation files perfectly tuned for LLMs. Scroll down to the Integration Guides section below and click the "LLM" badge next to the platform you are building for to get the specific integration context, endpoints, and code snippets.

Standard Ad Formats

Native Banner

Web & Mobile

Inline banner ads that adapt to their container. Perfect for headers, footers, or content breaks.

Banner Ad

Interstitial

Web & Mobile

Full-screen immersive experiences during natural application transitions.

Interstitial Ad Example

SDK Architecture

AdTogether is distributed as five separate SDK packages — each optimized for its target platform. The Flutter SDK is special: it wraps the native Android and iOS cores under the hood, giving Flutter developers a single Dart API that works everywhere.

Developer Entry Points

JavaScriptWeb (JS)ReactReact NativeFlutterFlutter (Dart)AppleNative iOS (Swift)AndroidNative Android (Kotlin)

Platforms Served

Web SDKWebsites, SPAs, SSR apps
React Native SDKReact Native CLI, Expo
Flutter SDKAndroid + iOS + Web (one package)
iOS SDKSwiftUI / UIKit apps
Android SDKCompose / View-based apps

How the Flutter SDK works internally

lib/

Unified Dart API — AdTogetherBanner, AdTogetherInterstitial, initialization.

android/

Kotlin plugin — uses Platform Channels to call the native Android ad renderer.

ios/

Swift plugin — uses Platform Channels to call the native iOS ad renderer.

On Flutter Web, the SDK renders ads using an HtmlElementView that loads the Web SDK (sdk.js) under the hood — no native plugin required.

Integration Guides

REST API endpoints

LLM

For complete control, or if you are building an integration for a custom platform, you can directly interact with the AdTogether Ad Serving REST API.

Fetch Ad

GET /api/ads/serve
curl -X GET "https://adtogether.relaxsoftwareapps.com/api/ads/serve?country=global"

Track Impression

POST /api/ads/impression
curl -X POST "https://adtogether.relaxsoftwareapps.com/api/ads/impression" \
  -H "Content-Type: application/json" \
  -d '{"adId": "123456", "token": "HMAC_TOKEN_FROM_FETCH"}'
React

Web SDK

LLM
HTML5HTML
ReactReact
Next.jsNext.js
Vue.jsVue

Embed ads into any webpage using our lightweight script. Zero dependencies — works with any framework.

Distribution

NPM Package (React/Next.js) or CDN-hosted script tag.

1. Install (React/Next.js)

terminal
npm install @adtogether/web-sdk

2. Usage (React)

MyComponent.tsx
"use client";
import { useState } from 'react';
import { AdTogether } from '@adtogether/web-sdk';
import { AdTogetherBanner, AdTogetherInterstitial } from '@adtogether/web-sdk/react';

if (typeof window !== 'undefined') {
  AdTogether.initialize({ appId: 'YOUR_APP_ID' });
}

export default function MyComponent() {
  const [showAd, setShowAd] = useState(false);

  return (
    <div>
      {/* Banner Ad */}
      <AdTogetherBanner 
        adUnitId="YOUR_AD_UNIT_ID" 
        onAdLoaded={() => console.log('Ad loaded!')}
      />
      
      {/* Interstitial Ad */}
      <button onClick={() => setShowAd(true)}>Show Interstitial</button>
      <AdTogetherInterstitial 
        adUnitId="YOUR_AD_UNIT_ID" 
        isOpen={showAd} 
        onClose={() => setShowAd(false)} 
        onAdLoaded={() => console.log('Interstitial loaded!')}
      />
    </div>
  );
}

Alternative: Plain HTML (CDN)

index.html
<script src="https://adtogether.relaxsoftwareapps.com/sdk.js" defer></script>
<!-- Banner Ad -->
<div id="adtogether-ad" data-ad-unit="YOUR_AD_UNIT_ID"></div>
3-in-1
Flutter

Flutter SDK

LLM
AndroidiOSWeb

One Dart package — full cross-platform coverage. Uses native platform channels on mobile and the Web SDK under the hood for Flutter Web.

Distribution

pub.dev package

1. Install

terminal
flutter pub add adtogether_sdk

2. Initialize

main.dart
import 'package:adtogether_sdk/adtogether_sdk.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await AdTogether.initialize(appId: 'YOUR_APP_ID');
  runApp(MyApp());
}

3. Show Ad

my_page.dart
// Show Banner
AdTogetherBanner(
  adUnitId: 'YOUR_AD_UNIT_ID',
  size: AdSize.banner,
  onAdLoaded: () => print('Ad loaded!'),
  onAdFailedToLoad: (e) => print('Error: $e'),
)

// Show Interstitial
AdTogetherInterstitial.show(
  context: context,
  adUnitId: 'YOUR_AD_UNIT_ID',
  closeDelay: const Duration(seconds: 3),
  onAdLoaded: () => print('Interstitial loaded!'),
);
Apple

Native iOS SDK

LLM
SwiftUIUIKit

Pure Swift SDK for native iOS and iPadOS apps. Distributed via Swift Package Manager.

Distribution

Swift Package Manager — add via Xcode or Package.swift

1. Add Package

Package.swift
.package(
  url: "https://github.com/undecided2003/AdTogether.git",
  from: "0.1.27"
)

2. Initialize & Display

ContentView.swift
import AdTogether

@main
struct MyApp: App {
    init() {
        AdTogether.initialize(appId: "YOUR_APP_ID")
    }

    var body: some Scene {
        WindowGroup { ContentView() }
    }
}

struct ContentView: View {
    @State private var showAd = false

    var body: some View {
        VStack {
            Text("My App")
            
            // Banner Ad
            AdTogetherView(
                adUnitId: "YOUR_AD_UNIT_ID",
                onAdLoaded: { print("Ad loaded!") }
            )
            .frame(height: 50)
            
            // Interstitial Ad
            Button("Show Interstitial") {
                showAd = true
            }
            .fullScreenCover(isPresented: $showAd) {
                AdTogetherInterstitialView(
                    adUnitId: "YOUR_AD_UNIT_ID",
                    closeDelay: 3,
                    onAdLoaded: { print("Interstitial loaded!") }
                ) { showAd = false }
            }
        }
    }
}
Android

Native Android SDK

LLM
Jetpack ComposeXML Views

Kotlin-first SDK for native Android apps. Distributed via Maven Central.

Distribution

Maven Central — add to build.gradle.kts

1. Add Dependency

build.gradle.kts
dependencies {
    implementation("com.relaxsoftwareapps.adtogether:sdk:0.1.27")
}

2. Initialize & Display

MainActivity.kt
import com.adtogether.sdk.AdTogether
import com.adtogether.sdk.views.AdTogetherView
import com.adtogether.sdk.views.AdTogetherInterstitial

class MyApp : Application() {
    override fun onCreate() {
        super.onCreate()
        AdTogether.initialize(this, "YOUR_APP_ID")
    }
}

@Composable
fun MainScreen() {
    var showAd by remember { mutableStateOf(false) }

    Column {
        Text("My App")
        
        // Banner Ad
        AdTogetherView(
            adUnitId = "YOUR_AD_UNIT_ID",
            modifier = Modifier.fillMaxWidth().height(50.dp),
            onAdLoaded = { println("Ad loaded!") }
        )
        
        // Interstitial Ad
        Button(onClick = { showAd = true }) {
            Text("Show Interstitial")
        }
        
        if (showAd) {
            AdTogetherInterstitial(
                adUnitId = "YOUR_AD_UNIT_ID",
                closeDelay = 3,
                onDismiss = { showAd = false },
                onAdLoaded = { println("Interstitial loaded!") }
            )
        }
    }
}

React Native SDK

LLM
ExpoReact Native CLI

Official support for React Native applications. Easy drop-in components to monetize your mobile apps.

Distribution

NPM Package

1. Install

terminal
npm install @adtogether/react-native-sdk

2. Initialize

App.tsx
import { AdTogether } from '@adtogether/react-native-sdk';

// Call before rendering ad components
AdTogether.initialize({ appId: 'YOUR_APP_ID' });

3. Usage

MyScreen.tsx
import { useState } from 'react';
import { View, Button } from 'react-native';
import { 
  AdTogetherBanner, 
  AdTogetherInterstitial 
} from '@adtogether/react-native-sdk';

export default function MyScreen() {
  const [showAd, setShowAd] = useState(false);

  return (
    <View style={{ flex: 1 }}>
      {/* Banner Ad */}
      <AdTogetherBanner 
        adUnitId="YOUR_AD_UNIT_ID" 
        onAdLoaded={() => console.log('Ad loaded!')}
      />
      
      {/* Interstitial Ad */}
      <Button 
        title="Show Interstitial" 
        onPress={() => setShowAd(true)} 
      />
      
      <AdTogetherInterstitial 
        adUnitId="YOUR_AD_UNIT_ID" 
        isOpen={showAd} 
        onClose={() => setShowAd(false)} 
        onAdLoaded={() => console.log('Interstitial loaded!')}
      />
    </View>
  );
}