Meter Ingest (with Segment.io)

You can ingest events using Segment.io.
https://segment.com/catalog/integrations/amberflo/

Segment's Amberflo Destination provides the ability to ingest meters (track, page, screen) and create customers (identify) in Amberflo.

Quick links:
Product Walkthrough
Meter Types
Customers
SDKs
API Reference

2188

Getting Started

  1. From the Destinations catalog page in the Segment App, click Add Destination.
  2. Search for Amberflo in the Destinations Catalog, and select the Amberflo destination.
  3. Choose which Source should send data to the Amberflo destination.
  4. Go to the Amberflo dashboard API Keys, find and copy the โ€œAPI keyโ€.
  5. Enter the โ€œAPI Keyโ€ in the Amberflo destination settings in Segment.

Supported methods

Page

Create a meter called page in Amberflo. See Create Meters. The page is ingested as meter with value 1.

analytics.page({
  userId: "some_user_id", 
  name: "Home",
  properties: {
   	"title": "Welcome | Initech",
    "keywords": "paper,comedy",
    "search": "schrute farms",
    "referrer": "https://google.com",
    "path": "/home",
    "browser": "Chrome",
    "url": "https://segment.com"
  }
})

Mappings:

Segment FieldAmberflo Field
messageIduniqueId
userId or anonymousId (if userId is blank)customerId
"page"meterApiName
timestampmeterTimeInMillis (epoch)
propertiesdimensions
namedimensions.name

Amberflo webhook endpoint:

curl --request POST \
     --url https: //app.amberflo.io/ingest \
     --header 'Accept: application/json' \
     --header 'Content-Type: application/json' \
     --header 'x-api-key: YOUR_API_KEY' \
     --data '
{
    "uniqueId": "messageId",
    "customerId": "some_user_id",
    "meterApiName": "page",
    "meterValue": 1.0,
    "meterTimeInMillis": 1619445706909,
    "dimensions": {
        "name": "Home",
        "title": "Welcome _ Initech",
        "keywords": "paper,comedy",
        "search": "schrute farms",
        "referrer": "https:__google.com",
        "path": "_home",
        "browser": "Chrome",
        "url": "https:__segment.com"
    }
}

Screen

Create a meter called screen in Amberflo. See Create Meters. The screen event is ingested as meter with value 1.

analytics.screen({
  userId: "some_user_id", 
  name: "Home",
  properties: {
   	"title": "Welcome | Initech"
  }
})

Mappings:

Segment FieldAmberflo Field
messageIduniqueId
userId or anonymousId (if userId is blank)customerId
"screen"meterApiName
timestampmeterTimeInMillis (epoch)
propertiesdimensions
namedimensions.name

Amberflo webhook endpoint:

curl --request POST \
     --url https://app.amberflo.io/ingest \
     --header 'Accept: application/json' \
     --header 'Content-Type: application/json' \
     --header 'x-api-key: YOUR_API_KEY' \
     --data '
{
     "uniqueId": "messageId",
     "customerId": "segmentUserId",
     "meterApiName": "screen",
     "meterValue": 1.0,
     "meterTimeInMillis": 1619445706909,
     "dimensions": {
       "name": "Home",
       "title": "Welcome _ Initech"
     }
}
'

Identify

Identify creates a customer in Amberflo or updates if customer already exists. See Create Customer. Segment's userId is required for a customer in Amberflo. If userId is not set, then the customer will not be created in Amberflo and the identify event will be discarded.

analytics.identify({
  userId: "some_user_id", 
  traits: {
    "name": "John Doe",
    "email": "[email protected]",
    "plan": "premium",
    "logins": 5,
    "phone": "650-769-3240",
    "username": "marakasina",
    "website": "example.com",
    "avatar": "https://s3.amazonaws.com/uifaces/faces/twitter/scottkclark/128.jpg"
  }
})

Mappings:

Segment FieldAmberflo Field
userIdcustomerId
traits.namecustomerName
traits.emailcustomerEmail
traits (without the name and email)traits

Amberflo webhook endpoint:

curl --request PUT \
     --url https://app.amberflo.io/customers \
     --header 'Accept: application/json' \
     --header 'Content-Type: application/json' \
     --header 'x-api-key: YOUR_API_KEY' \
     --data '
{
     "customerId": "XXXX-ZZZZZ",
     "customerName": "myCustomerName",
     "customerEmail" "[email protected]",
     "traits": {
        "plan": "premium",
        "logins": 5,
        "phone": "650-769-3240",
        "username": "marakasina",
        "website": "example.com",
        "avatar": "https:__s3.amazonaws.com_uifaces_faces_twitter_scottkclark_128.jpg"
    }
}
'

Track

Create a meter in Amberflo for the track event in Segment. See Create Meters. The Segment track event is ingested as a meter with value of properties.value, or 1 if the value is not set.

analytics.track({
  userId: "some_user_id", 
  event: "ApiCalls",
  properties: {
    "value" : 2.0
   	"region": "us-west-2"
  }
})

Mappings:

Segment FieldAmberflo Field
messageIduniqueId
userId or anonymousId (if userId is blank)customerId
eventmeterApiName
timestampmeterTimeInMillis (epoch)
propertiesdimensions
properties.value or 1.0 (if properties.value is not set)meterValue

Amberflo webhook endpoint:

curl --request POST \
     --url https://app.amberflo.io/ingest \
     --header 'Accept: application/json' \
     --header 'Content-Type: application/json' \
     --header 'x-api-key: YOUR_API_KEY' \
     --data '
{
     "uniqueId": "messageId",
     "customerId": "some_user_id",
     "meterApiName": "ApiCalls",
     "meterValue": 2.0,
     "meterTimeInMillis": 1619445706909,
     "dimensions": {
      	"region": "us-west-2"
     }
}
'

Links

Segment Catalog -> Amberflo
Segment Destination Documentation -> Amberflo