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

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

Event format

Glassfy sends 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": "my_custom_identifier",
      "anonymousId":"61566a11090b4b288a4351158dcc9ee5" 
      "timestamp": "2021-04-28 15:33:28.413754 +0200 CEST m=+1356.540492913",
      "event": 5002,
      "properties": {
        "app_user_id": "my_custom_identifier",
        "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 integrate the Segment SDK in your app, follow these instructions

The subscriberId is assigned to the segment anonymousId.

The segment userId is sent if the following code is called. Read this documentation on how to setup the custom identifier.

Glassfy.connectCustomSubscriber("my_custom_identifier") { error in
    // handle error.
}
[Glassfy connectCustomSubscriber:@""my_custom_identifier"" withCompletion:nil];
await Glassfy.connectCustomSubscriber("my_custom_identifier");
await Glassfy.connectCustomSubscriber('my_custom_identifier');
await Glassfy.connectCustomSubscriber({ subscriberId: 'my_custom_identifier' });
Glassfy.connectCustomSubscriber("my_custom_identifier") { error ->
    // handle error.
}

The subscriberId is assigned to the segment anonymousId.

The advertisingId is set to Idfa on iOS and Gaid on Android. Read this documentation on how to setup attributions parameters.