Vibe Growth SDK Documentation

Integrate attribution, revenue tracking, and session analytics into your mobile app.

Getting Started

The Vibe Growth SDK provides attribution, user identity, revenue tracking, and session analytics for mobile apps. It supports four platform targets.

iOS
iOS 14+
Android
API 21+
Flutter
Flutter 3.x
Unity
Unity 2021+
SDK version2.1.0

Installation

Add the SDK via Swift Package Manager. In Xcode go to File → Add Package Dependencies… and paste the URL below, then pin to version 0.0.1.

swift
1// Package.swift
2.package(
3 url: "https://github.com/VibeGrowthPlatform/growth-sdk.git",
4 from: "0.0.1"
5)
6
7// Xcode: paste this URL in Add Package Dependencies
8// https://github.com/VibeGrowthPlatform/growth-sdk.git

Initialization

Initialize the SDK as early as possible in your app lifecycle. You can find your App ID and API Key in the Vibe Growth dashboard under SDK Install.

swift
1import VibeGrowthSDK
2
3// In AppDelegate or app entry point
4VibeGrowthSDK.shared.initialize(
5 appId: "YOUR_APP_ID",
6 apiKey: "YOUR_API_KEY"
7) { success, error in
8 if let error {
9 print("[VibeGrowth] Init failed: \(error)")
10 return
11 }
12 print("[VibeGrowth] Initialized successfully")
13}

User Identity

How identity works

  • Device ID is generated automatically on first launch. Resolution order: GAID/IDFA, then IDFV/ANDROID_ID, then random UUID.
  • User ID is set by the developer after login or registration.
  • Both values persist across app restarts via local storage.
  • On reinstall, the device ID may be recovered from hardware identifiers, but the user ID must be set again by your app.
swift
1// Set user identity after login
2VibeGrowthSDK.shared.setUserId("user-123")
3
4// Retrieve current user ID
5let userId = VibeGrowthSDK.shared.getUserId()
6
7// Retrieve auto-generated device ID
8let deviceId = VibeGrowthSDK.shared.getDeviceId()

Revenue Tracking

Manual Purchase Tracking

Record a purchase event with price, currency, and product identifier. Works on all platforms.

swift
1VibeGrowthSDK.shared.trackPurchase(
2 pricePaid: 4.99,
3 currency: "USD",
4 productId: "gem_pack_100"
5)

Automatic Purchase Tracking (iOS)

On iOS, the SDK automatically observes StoreKit transactions when autoTrackPurchases is enabled (default: true).

  • Uses StoreKit 2 on iOS 15+ (Transaction.updates)
  • Falls back to StoreKit 1 (SKPaymentTransactionObserver) on iOS 14
  • Price and currency are resolved automatically
  • Transactions are deduplicated

To disable automatic tracking:

swift
1VibeGrowthSDK.shared.initialize(
2 appId: "YOUR_APP_ID",
3 apiKey: "YOUR_API_KEY",
4 baseUrl: nil,
5 autoTrackPurchases: false
6)

Google Play Purchase Tracking (Android)

Use the convenience method to record Google Play Billing purchases. It automatically extracts price, currency, and product ID from the billing objects.

  • Handles both one-time purchases and subscriptions (uses recurring price for subs)
  • Requires the Google Play Billing Library dependency in your app
kotlin
1// In your PurchasesUpdatedListener
2VibeGrowthSDK.trackGooglePlayPurchase(purchase, productDetails)

Ad Revenue Tracking

Record ad revenue events from mediation sources such as AdMob, ironSource, or MAX.

swift
1VibeGrowthSDK.shared.trackAdRevenue(
2 source: "admob",
3 revenue: 0.02,
4 currency: "USD"
5)

Session Tracking

  • The first session is auto-detected by the SDK on initial launch.
  • Timestamps must be in ISO 8601 format.
  • Session state persists across app restarts.
swift
1VibeGrowthSDK.shared.trackSessionStart(
2 sessionStart: ISO8601DateFormatter().string(from: Date())
3)

Remote Config

Fetch remote configuration values by key. The SDK retrieves values from the Vibe Growth backend and delivers them via a callback.

swift
1VibeGrowthSDK.shared.getRemoteConfig(key: "onboarding_variant") { value, error in
2 if let error {
3 print("[VibeGrowth] Config error: \(error)")
4 return
5 }
6 if let value {
7 print("[VibeGrowth] Config value: \(value)")
8 }
9}

Testing in Development

iOS -- StoreKit Testing

  1. Create a StoreKit Configuration file in Xcode (File > New > File > StoreKit Configuration).
  2. Add test products matching your product IDs.
  3. Enable in scheme: Edit Scheme > Run > Options > StoreKit Configuration.
  4. Purchases in the simulator trigger the auto-tracking observer.
  5. No sandbox account is needed for local testing.

Android -- Google Play Billing Testing

  1. Use Google Play Console's internal testing track.
  2. Add license test accounts in the console.
  3. Use test card numbers (always approved).
  4. trackGooglePlayPurchase() works with test purchases.

General

  • Use your development API key from the dashboard.
  • All SDK endpoints work in development mode.
  • Verify events appear in the Vibe Growth dashboard under Analytics.
  • Use "Test Connection" on the SDK Install page to confirm integration.

API Reference

All public methods available in the Vibe Growth SDK.

MethodPlatformsDescription
initialize(appId, apiKey, ...)AllInitialize the SDK with your app credentials.
setUserId(userId)AllAssociate a user identity after login or registration.
getUserId()iOS, AndroidRetrieve the currently set user ID.
getDeviceId()iOS, AndroidRetrieve the auto-generated device identifier.
trackPurchase(price, currency, productId)AllManually record a purchase event.
trackGooglePlayPurchase(purchase, productDetails)AndroidRecord a Google Play Billing purchase with automatic field extraction.
trackAdRevenue(source, revenue, currency)iOS, AndroidRecord ad revenue from a mediation source.
trackSessionStart(sessionStart)iOS, AndroidRecord a session start event with an ISO 8601 timestamp.
getRemoteConfig(key, callback)iOS, AndroidFetch a remote configuration value by key.