Amplitude
Send subscriptions events to Amplitude. Glassfy monitors the subscriptions and sends relevant events to Amplitude even if the user does not have the app open.
- Copy the "API Key" from Amplitude ORG SETTINGS -> Projects -> General
- Open the Amplitude connector settingx in the Glassfy dashboard and paste the "API Key"
- If you are integrating the Amplitude SDK in your app, follow these instruction to connect the events data with the user
Event format
Glassfy sends Amplitude a record with the following format every time an event is generated:
{
"api_key": "XXXXXXXXXXXXX",
"events": [
{
"event_type": 5001,
"user_id": "43ac4928d1c048eab25dec698ae4f0bd",
"time": 1619706461000,
"app_version": "1.0",
"os_name": "iOS",
"device_manufacturer": "Apple",
"os_version": "12.5.1",
"sdk_version": "dev",
"bundle_version": "66",
"country": "GB",
"revenue": 2.7772076344423917,
"productId": "ios_premium_weekly_1_99",
"quantity": 1,
"event_properties": {
"expires_at": 1607955966000,
"purchased_at": 1607955786000,
"environment": "Sandbox",
"product_permissions": "articles,",
"presented_offering_id": "",
"transaction_id": "1000000788008512",
"original_transaction_id": "1000000754137991"
}
}
]
}
Integrate with Amplitude SDK
If you integrate the Amplitude SDK in your app, follow these instructions{:target="_blank"} and add the following code:
Glassfy.initialize(apiKey: "YOUR_API_KEY", userId: "appUserId")
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Initialize SDK
Amplitude.instance()?.initializeApiKey("API_KEY")
// Set userId
Amplitude.instance()?.setUserId("userId")
// Log an event
Amplitude.instance()?.logEvent("app_start")
return true
}
[Glassfy initializeWithAPIKey:@"YOU_API_KEY" userId:@"appUserId"];
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Enable sending automatic session events
[Amplitude instance].trackingSessionEvents = YES;
// Initialize SDK
[[Amplitude instance] initializeApiKey:@"API_KEY"];
// Set userId
[[Amplitude instance] setUserId:@"userId"];
// Log an event
[[Amplitude instance] logEvent:@"app_start"];
return YES;
}
Updated almost 2 years ago