npm install scatesdk-reactTo ensure that the ScateSDK works properly on Android, you need to add the Maven repository to your build.gradle file.
This wrapper version uses com.scate:scatesdk:7.0.11 or newer for Adjust integration and parameterized events.
In your project's android/build.gradle file, add the following Maven repository:
repositories {
// Other repositories
maven {
url "https://europe-west1-maven.pkg.dev/mavenrepo-433814/scatecoresdk-android"
}
}
In your android/app/build.gradle file, under buildTypes, please add the following lines:
buildTypes {
release {
minifyEnabled false
shrinkResources false
}
}
Note:
If you enable minifyEnabled (code shrinking and obfuscation) in your build.gradle,
you must keep ScateSDK classes to avoid issues with JSON serialization (such as @SerializedName fields turning into random letters).
To do this, add the following to your proguard-rules.pro file:
-keep class com.scatesdkreact.** { *; }
-keepclassmembers class com.scatesdkreact.** { *; }
This wrapper version uses ScateSDK 7.0.10 or newer and Adjust 5.6.1 or newer for Adjust integration. Add NSUserTrackingUsageDescription to the iOS app Info.plist if you want ScateSDK to request App Tracking Transparency authorization.
If CocoaPods reports that the Swift pod scatesdk-react depends on Adjust and Adjust does not define modules, add Adjust as a modular header in the app Podfile:
pod 'Adjust', '~> 5.6.1', :modular_headers => trueimport { ScateSDK } from 'scatesdk-react';
ScateSDK.Init('your app id');
ScateSDK.InitAdjust('your adjust token');
ScateSDK.GetAdjustId((adid) => {
// ADID is non-empty here.
});By default, on iOS, InitAdjust configures Adjust with a 120 second ATT consent wait interval and requests App Tracking Transparency authorization at init time. Add NSUserTrackingUsageDescription to the iOS app Info.plist for the prompt to appear. Pass noATT: true to skip ScateSDK's ATT request path:
ScateSDK.InitAdjust('your adjust token', { noATT: true });When an ADID is resolved, ScateSDK stores it as the SDK ADID and sends scate_adjust_id once after ScateSDK is initialized. If your app already initializes Adjust, avoid calling InitAdjust a second time; keep your app-owned Adjust setup and call ScateSDK.GetAdjustId(...) after Adjust is ready, or continue to use ScateSDK.SetAdid(adid).
By default, on iOS, when Firebase Analytics is linked and configured in the host app, ScateSDK sets Firebase user_id to the Scate user ID during initialization. If your app already manages Firebase user_id, disable this before initialization:
ScateSDK.Init('your app id', {
firebaseUserIdSyncEnabled: false,
});To send events, you can use the following code:
ScateSDK.Event('button_clicked');Pass a dictionary as the optional second argument to Event. These values are sent as event parameters.
ScateSDK.Event('button_clicked', {
screen: 'paywall',
position: 1,
isPrimary: true,
});Use this only when you need the legacy customValue field.
ScateSDK.EventWithValue('button_clicked', 'subscribe_btn');Send a customValue and a parameters dictionary together in a single event.
ScateSDK.EventWithValueAndParameters('result', 'grade_changed', {
grade: 'PSA10',
});ScateSDK.GetRemoteConfig('key', 'defaultValue');ScateSDK.AddListener(ScateEvents.REMOTE_CONFIG_READY, (event) => {});ScateSDK.RemoveListener(ScateEvents.REMOTE_CONFIG_READY);ScateSDK.CleanListeners(ScateEvents.REMOTE_CONFIG_READY);ScateSDK.OnboardingStart();
ScateSDK.OnboardingStep('location_screen');
ScateSDK.OnboardingStep('notification_screen');
ScateSDK.OnboardingStep('personalization_screen');
ScateSDK.OnboardingStep('journey_screen');
ScateSDK.OnboardingStep('intro_paywall_screen');
ScateSDK.OnboardingStep('fullscreen_ad');
ScateSDK.OnboardingFinish();ScateSDK.LoginSuccess('apple');
ScateSDK.LoginSuccess('email');
ScateSDK.LoginSuccess('fb');
ScateSDK.LoginSuccess('google');ScateSDK.InterstitialAdShown();
ScateSDK.InterstitialAdClosed();
ScateSDK.RewardedAdShown();
ScateSDK.RewardedAdClosed();
ScateSDK.RewardedAdClaimed();
ScateSDK.BannerAdShown();ScateSDK.NotificationPermissionGranted();
ScateSDK.NotificationPermissionDenied();
ScateSDK.LocationPermissionGranted();
ScateSDK.LocationPermissionDenied();
ScateSDK.ATTPromptShown();
ScateSDK.ATTPermissionGranted();
ScateSDK.ATTPermissionDenied();ScateSDK.PaywallShown('paywall_name');
ScateSDK.PaywallClosed('paywall_name');
ScateSDK.PaywallAttempted('paywall_name');
ScateSDK.PaywallPurchased('paywall_name');
ScateSDK.PaywallCancelled('paywall_name');ScateSDK.TabClicked('x');
ScateSDK.FeatureClicked('x');ScateSDK.DailyStreakShown();
ScateSDK.DailyStreakClaimed();
ScateSDK.DailyStreakClosed();ScateSDK.RevenuecatInitiated();
ScateSDK.AdjustInitiated();
ScateSDK.AdjustSetToRevenuecat();ScateSDK.SplashCompleted();ScateSDK.FirebaseRemoteInitiated();ScateSDK.HomeScreenOpen();ScateSDK.OnboardingPaywallShown();
ScateSDK.OnboardingPaywallClosed();ScateSDK.SubscriptionSuccess();
ScateSDK.InAppPurchaseSuccess();
ScateSDK.SubsStart();
ScateSDK.SubsSuccess();
ScateSDK.SubsFail();
ScateSDK.SubsCancel();ScateSDK.ContentCreateStart();
ScateSDK.ContentCreateSuccess();
ScateSDK.ContentCreateFail();Report to Scate that third-party services (Adjust, RevenueCat, Firebase, etc.) are ready in your app. This event does not initialize them.
ScateSDK.AllServicesInitialized();ScateSDK.ShowEventList();- Parameter:
jsonString— A JSON string containing the screen paywall configuration. ⚠️ Note: You can find an example JSON object in theexample/src/App.tsxfile of the SDK repository.
ScateSDK.ShowPaywall('jsonString');ScateSDK.ClosePaywall();- Parameter:
jsonString— A JSON string containing the onboarding configuration. ⚠️ Note: You can find an example JSON object in theexample/src/App.tsxfile of the SDK repository.
ScateSDK.ShowOnboarding('jsonString');ScateSDK.CloseOnboarding();ScateSDK.ShowPaidProductLoadingScreen();ScateSDK.ClosePaidProductLoadingScreen();ScateSDK.AddListener(
ScateEvents.ONBOARDING_SCREENS_FINISHED,
(identifier) => {}
);
ScateSDK.AddListener(ScateEvents.PAYWALL_SCREEN_FINISHED, (identifier) => {});
ScateSDK.AddListener(ScateEvents.PAID_PRODUCT_CLICKED, (identifier) => {});
ScateSDK.AddListener(ScateEvents.PAYWALL_SCREEN_CLOSED, (success) => {});
ScateSDK.AddListener(ScateEvents.ONBOARDING_SCREEN_CLOSED, (success) => {});
ScateSDK.AddListener(ScateEvents.RESTORE_PURCHASE_CLICKED, (success) => {});