Link Search Menu Expand Document

Segment

Send subscriptions events to Segment . Glassfy monitor the subscriptions and sends all the relevant events to Segment even if the user does not open the app.

  1. Copy the “Write Key” from Segment Workspace -> Connections -> Sources
  2. Open Segment connector setting in the Glassfy dashboard and paste the “Write Key”
  3. If you are integrating the Segment SDK in your app you can following this instruction to connect the events data with the user.

Event format

Glassfy will send to Segment a record with the following format every time an event is generated

{
  "context": {
    "environment": "Sandbox",
    "library": {
      "name": "Glassfy Segment",
      "version": "1.0"
    }
  },
  "batch": [
    {
      "type": "track",
      "userId": "43ac4928d1c048eab25dec698ae4f0bd",
      "timestamp": "2021-04-28 15:33:28.413754 +0200 CEST m=+1356.540492913",
      "event": "SubscriptionRenewed",
      "properties": {
        "app_user_id": "",
        "currency": "GBP",
        "country_code": "GB",
        "entitlements": null,
        "entitlement": "",
        "expires_at": 1607955966000,
        "subscriber_id": "43ac4928d1c048eab25dec698ae4f0bd",
        "product_id": "ios_premium_weekly_1_99",
        "revenue": 2.7682972449546117,
        "store": "APP_STORE",
        "purchased_at": 1607955786000,
        "environment": "Sandbox",
        "product_permissions": "articles,",
        "presented_offering_id": "",
        "transaction_id": "1000000788008512",
        "original_transaction_id": "1000000754137991",
        "sub_platform": "1",
        "system_version": "12.5.1",
        "device": "iPhone7,1",
        "sdk_version": "dev",
        "bundle_version": "66",
        "app_version": "1.0"
      }
    }
  ]
}

Integrate with Segment SDK

If you optionally integrate the Segment SDK in your app please follow the instructions here and add the following code.

  • Glassfy.initialize(apiKey: "YOUR_API_KEY", userId: "appUserId")
    
    Analytics.setup(with: AnalyticsConfiguration(writeKey: "YOUR_WRITE_KEY"))
    
  • [Glassfy initializeWithAPIKey:@"YOU_API_KEY" userId:@"appUserId"];
    
    [SEGAnalytics setupWithConfiguration:[SEGAnalyticsConfiguration configurationWithWriteKey:@"YOUR_WRITE_KEY"]];
    

Copyright © 2021 Glassfy.