Integration guides

Connect a website or app, send a test event, and verify what reaches your merchant dashboard.

Website

Create a merchant project and copy its test client key from Settings. Load this snippet once, after the visitor grants any required consent. Replace YOUR_PROJECT_TEST_KEY with that key.

Open a page and check Live events in the test environment for page_viewed. Use the live client key when the test passes. Session replay is available for websites.

<script>
  window.kma = window.kma || function () {
    (window.kma.q = window.kma.q || []).push(arguments);
  };
</script>
<script async src="https://merchant.kissmyapps.dev/sdk/kma.js"
        data-key="YOUR_PROJECT_TEST_KEY"></script>

React for the web

Put the website snippet in the host HTML once. The web SDK records client-side route changes. Send your product events from the interaction that actually happened.

Click the button once and look for one plan_selected event in the test project.

export function ChoosePlan() {
  return <button onClick={() => window.kma?.('track', 'plan_selected', {plan: 'annual'})}>
    Choose annual plan
  </button>;
}

React Native and Expo

Install the SDK and AsyncStorage in your app. If you use Expo, use the Expo command so it selects the storage version for your SDK.

# React Native
npm install @kissmyappss/react-native@1.1.0 @react-native-async-storage/async-storage

# Expo
npx expo install @kissmyappss/react-native@1.1.0 @react-native-async-storage/async-storage

Initialize once at startup after analytics consent. Use the development client key from your merchant dashboard, send an event and check for it in the project's development events.

// App.tsx
import AsyncStorage from '@react-native-async-storage/async-storage';
import { KissMyApps } from '@kissmyappss/react-native';

KissMyApps.init({key: 'YOUR_PROJECT_TEST_KEY', storage: AsyncStorage});
KissMyApps.track('plan_selected', {plan: 'annual'});

Expo Go supports event analytics. For Google Play install referrers or Apple Ads attribution, rebuild a bare app or an Expo development build with the native module. For a bare iOS app, run pod install in ios/ before rebuilding. Enable attribution for your project and configure the app's link domains to receive smart links with KissMyApps.onDeepLink.

React Native 1.1.0 API and native setup

Flutter

Add the published package to your Flutter app with flutter pub add kissmyapps. Initialize after the Flutter bindings are available and before runApp. Add KissMyAppsObserver to record named screens.

import 'package:flutter/widgets.dart';
import 'package:kissmyapps/kissmyapps.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  KissMyApps.start('YOUR_PROJECT_TEST_KEY');
  runApp(const MyApp());
}
Published package and setup

Native iOS

In Xcode, choose File → Add Package Dependencies. Add https://github.com/onorhime/kissmyapps-mobile and select version 1.1.0. Link the KissMyApps product to your app target. Start once in your app initializer.

import KissMyApps

KissMyApps.start(key: "YOUR_PROJECT_TEST_KEY")
KissMyApps.track("plan_selected", properties: ["plan": "annual"])
Tagged iOS source and guide

Native Android

Add JitPack to dependencyResolutionManagement.repositories in settings.gradle.kts, then add the dependency in the app module. Start the SDK in Application.onCreate after super.onCreate().

// settings.gradle.kts, inside repositories
maven { url = uri("https://jitpack.io") }

// app/build.gradle.kts, inside dependencies
implementation("com.github.onorhime:kissmyapps-mobile:1.1.0")

// Inside Application.onCreate()
com.kissmyapps.KissMyApps.start(this, "YOUR_PROJECT_TEST_KEY")
Tagged Android source and guide

Server events and revenue

Create a test server key under Project settings → API keys. Keep it in your server’s secret store. Use a stable internal customer ID that matches the ID your app uses to identify the customer. For an order, generate a unique insert ID that stays the same on retries.

curl https://events.kissmyapps.dev/v1/events \
  -H "Authorization: Bearer ${KMA_TEST_SERVER_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{"user_id":"fixture-customer","events":[{
    "name":"purchase","insert_id":"fixture-payment-1042",
    "properties":{"kma_revenue":20,"kma_currency":"USD",
                  "kma_transaction_id":"fixture-order-1042"}
  }]}'

Verify one purchase in the test event feed. For an analytics refund, use a separate insert ID, the original transaction ID and a negative amount. Verified program commissions use the connected billing provider’s receipts.

App Store and Google Play sales

Under Connections, choose RevenueCat or Adapty. Copy that workspace’s generated webhook URL and authentication details into the provider’s integration settings. Identify users with the same internal app user ID in both SDKs. Use the provider’s test delivery first and look for a receipt under the connection.

For a program paying sale commission, test a purchase and refund from the same store transaction. Look under Sales for the purchase and refund, then compare the creator’s earnings. Earlier refunds waiting for the original purchase appear under reconciliation exceptions.

Attribution and checkout

For a web program using your own Stripe checkout, obtain the creator click from the initialized web SDK. Send it to your server alongside the checkout request and attach it as metadata.kma_click on the Stripe payment. Keep Stripe credentials server-side.

For hosted checkout, choose the product and price under Program, then use the generated destination. For native store commissions, connect RevenueCat or Adapty under Connections and use the same stable app user ID when identifying the signed-in customer.

Flutter, Swift, Android and React Native 1.1.0 support install attribution, deep links and revenue events. In React Native, pass the confirmed store transaction ID to KissMyApps.revenue. For a refund, send a negative amount with the original transaction ID.

// Browser, after the customer chooses a plan
const kmaClick = window.kma?.getClickId?.() ?? null;
await fetch('/api/checkout', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({plan: 'annual', kmaClick})
});

// Server, after validating the selected plan and click
const payment = await stripe.paymentIntents.create({
  amount: annualPlan.amountMinor, currency: annualPlan.currency,
  metadata: kmaClick ? {kma_click: kmaClick} : {}
});

Ad network install reports

For Meta and TikTok campaigns, use this server integration when your measurement provider can return your own first-launch identifiers. With the user’s permission, associate the SDK’s anonymous ID and first session ID with the permitted network callback. On your server, authenticate the callback as your provider specifies. Send one request with a unique report ID and a KissMyApps project server key. Keep the server key in server-side configuration.

// Inside your authenticated provider callback
await fetch(KMA_FUNCTIONS_URL + '/attribution-network-install', {
  method: 'POST',
  headers: { Authorization: 'Bearer ' + KMA_SERVER_KEY,
             'Content-Type': 'application/json' },
  body: JSON.stringify({ network: 'tiktok', platform: 'android',
    report_id: report.id, campaign: report.campaign,
    anonymous_id: report.kmaAnonymousId, session_id: report.kmaFirstSessionId,
    attribution_consent: customerHasAttributionConsent })
});

Copy the project Functions base URL from your dashboard. Use a test key first. A matched response appears in Sources. Existing attribution keeps its credit. If the SDK’s install is still pending, retry the same report ID after the install arrives. A conflicting receipt or an ambiguous match requires review.

For Apple SKAdNetwork, open Attribution → Apple ad attribution for the forwarding endpoint, supported versions and signed aggregate counts. Use Costs → Ad accounts to import Meta and TikTok spend.

Server-side funnel reporting

In the merchant dashboard, behavioral funnels count sequences of SDK events. A partner-facing journey uses published stages and signed events from your backend. Ask the program operator for the product, funnel, environment and signing configuration. Keep signing credentials on your server.

Funnel event API and examples ↗

Verify your setup

Use a test key and a synthetic user. Track one event, identify the user, open a second screen, sign out and reset the identity. Verify the event, session and user in the merchant console.

For an affiliate program, test the invitation, approval, creator link, checkout and credited sale. Check a refund and compare the merchant sale with creator earnings. Use a provider test environment for money movement. For a $20 order with no tax and a 30% sale commission, check for $6 pending. A full refund should reduce the earned amount to $0. Your agreement sets the actual rate and hold.

Open merchant dashboard