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.
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.
1// Package.swift2.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 Dependencies8// https://github.com/VibeGrowthPlatform/growth-sdk.gitInitialization
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.
1import VibeGrowthSDK2 3// In AppDelegate or app entry point4VibeGrowthSDK.shared.initialize(5 appId: "YOUR_APP_ID",6 apiKey: "YOUR_API_KEY"7) { success, error in8 if let error {9 print("[VibeGrowth] Init failed: \(error)")10 return11 }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.
1// Set user identity after login2VibeGrowthSDK.shared.setUserId("user-123")3 4// Retrieve current user ID5let userId = VibeGrowthSDK.shared.getUserId()6 7// Retrieve auto-generated device ID8let deviceId = VibeGrowthSDK.shared.getDeviceId()Revenue Tracking
Manual Purchase Tracking
Record a purchase event with price, currency, and product identifier. Works on all platforms.
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:
1VibeGrowthSDK.shared.initialize(2 appId: "YOUR_APP_ID",3 apiKey: "YOUR_API_KEY",4 baseUrl: nil,5 autoTrackPurchases: false6)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
1// In your PurchasesUpdatedListener2VibeGrowthSDK.trackGooglePlayPurchase(purchase, productDetails)Ad Revenue Tracking
Record ad revenue events from mediation sources such as AdMob, ironSource, or MAX.
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.
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.
1VibeGrowthSDK.shared.getRemoteConfig(key: "onboarding_variant") { value, error in2 if let error {3 print("[VibeGrowth] Config error: \(error)")4 return5 }6 if let value {7 print("[VibeGrowth] Config value: \(value)")8 }9}Testing in Development
iOS -- StoreKit Testing
- Create a StoreKit Configuration file in Xcode (File > New > File > StoreKit Configuration).
- Add test products matching your product IDs.
- Enable in scheme: Edit Scheme > Run > Options > StoreKit Configuration.
- Purchases in the simulator trigger the auto-tracking observer.
- No sandbox account is needed for local testing.
Android -- Google Play Billing Testing
- Use Google Play Console's internal testing track.
- Add license test accounts in the console.
- Use test card numbers (always approved).
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.
| Method | Platforms | Description |
|---|---|---|
| initialize(appId, apiKey, ...) | All | Initialize the SDK with your app credentials. |
| setUserId(userId) | All | Associate a user identity after login or registration. |
| getUserId() | iOS, Android | Retrieve the currently set user ID. |
| getDeviceId() | iOS, Android | Retrieve the auto-generated device identifier. |
| trackPurchase(price, currency, productId) | All | Manually record a purchase event. |
| trackGooglePlayPurchase(purchase, productDetails) | Android | Record a Google Play Billing purchase with automatic field extraction. |
| trackAdRevenue(source, revenue, currency) | iOS, Android | Record ad revenue from a mediation source. |
| trackSessionStart(sessionStart) | iOS, Android | Record a session start event with an ISO 8601 timestamp. |
| getRemoteConfig(key, callback) | iOS, Android | Fetch a remote configuration value by key. |