Segment
If you have a Segment.com instance, the easiest way to ingest events into Metronome is to send events from Segment.
Initial Setup
- From the Segment Destinations page, click on Add Destination. Search for and select Metronome (Actions) within the Destinations Catalog.
- Click on Configure Metronome (Actions), select the source you'd like to connect to, and give the destination a name (e.g., Metronome Instance #1).
- Enter your Metronome API token on the Settings pane in the API Token box and save changes.
Data field mapping
Your Segment events need to be mapped to the Metronome usage event format. The five fields listed are the required fields for Metronome. To start, click on the Mappings tab at the top of the Settings pane. A set of mappings is created by default; to add to or change them, choose Edit Mapping from the ellipsis dropdown.
It is required to specify a mapping even if the property name does not differ between the Segment event and the Metronome payload.
The required fields for Metronome are:
transaction_id
(string) - unique identifier for each eventcustomer_id
(string) - which customer in Metronome the event applies totimestamp
(string) - when the event happened in RFC 3339event_type
(string) - the kind of event, e.g.page_view
orcpu_used
properties
(object) - key/value pairs with details of the event
If your track
call looks like this:
analytics.track('billing_event', {
cid: '533c3db43f22',
data: {
action: 'runJob',
jobId: 'fd82-aa0f-45a7-a756',
username: 'jsmith'
},
t: 'user_action',
ts: new Date('2020-04-02T00:10:25.000Z')
});
then your field mapping should look like this:
Metronome usage events require the transaction_id
field to ensure all events are processed exactly once. The default mapping uses the Segment messageId
field as the Metronome transaction_id
. This is probably ideal for most users, but if you want to control the Metronome transaction_id
manually, you can provide a mapping to any field in the Segment event.
Additional Destination Actions
The integration supports Destination Actions, allowing users to create subscriptions. This means that the Metronome (Actions) destination sends data to Metronome based on a set of conditions known as triggers. Additional triggers and mappings can be created by clicking on the New Mapping button on the Mapping pane. A trigger can be set for any number of conditions. For instance, you could only trigger the sending of events to Metronome when the User ID
field is not an email address from your company (does not contain @company.com
).