# Moesif API Analytics Destination

## Destination Info

* Accepts [Identify](/docs/segment/connections/spec/identify) calls.
* Refer to it as **moesif-api-analytics**, **Moesif API Analytics** in the [Integrations object.](/docs/segment/guides/filtering-data/#filtering-with-the-integrations-object)
* This integration is **partner owned.** Please reach out to the partner's support for any issues.

[Moesif API Analytics](https://www.moesif.com/?utm_source=segmentio\&utm_medium=docs\&utm_campaign=partners) helps you drive API adoption, usage, and retention. With Moesif, track your customer journey from initial ad click to first API call while identifying at-risk customers struggling to integrate with your APIs.

The [Moesif SDKs and API gateway plugins](https://www.moesif.com/implementation?utm_source=segmentio\&utm_medium=docs\&utm_campaign=partners) are open-source and support REST, GraphQL, and other APIs.

This destination is maintained by Moesif. For any issues with the destination, [contact the Moesif team](mailto:support@moesif.com).

## Getting Started

1. From the Segment web app, click **Catalog**.
2. Search for "Moesif" in the Catalog, select it, and choose which of your sources to connect the destination to.
3. Enter the Moesif "API Key" into the destinations settings in the Segment App. You can find these by going to
   your [Moesif account](https://www.moesif.com) and navigating to the extensions settings.
4. Once integrated, Segment data shows up in Moesif in a few seconds.

> \[!NOTE]
>
> You can use Segment's [Replay feature](/docs/segment/guides/what-is-replay/) to sync historical events sent through Segment into your Moesif app.

## Identify

If you're not familiar with the Segment Specs, take a look to understand what the [Identify method](/docs/segment/connections/spec/identify/) does. An example call would look like:

```js
analytics.identify('userId123', {
      first_name: 'John',
      last_name: 'Doe',
      email: 'john@example.com',
      company: {
          id: '67890',
          plan: 'Free'
      }
});
```

Segment sends `identify()` calls to Moesif as [user updates](https://www.moesif.com/docs/getting-started/users/#the-update-user-endpoint?utm_source=segmentio\&utm_medium=docs\&utm_campaign=partners) which you can see in the *Users* section in Moesif. If you set `traits.company.id` on the user, Moesif associates them with a company. The integration maps user fields as follows:

| Segment Field       | Moesif Field |
| ------------------- | ------------ |
| `userId`            | `user_id`    |
| `traits`            | `metadata`   |
| `traits.company.id` | `company_id` |

The integration handles Segment [reserved traits](/docs/segment/connections/spec/identify/#traits) like `email` and `firstName`. It maps [automatically-collected fields](/docs/segment/connections/spec/common/#context-fields-automatically-collected) like campaign information and IP address.

## Track

If you haven't had a chance to review our spec, take a look tounderstand what the [Track](/docs/segment/connections/spec/track/) method does. An example call would look like:

```text
analytics.track('Login Button Clicked')
```

Segment sends `track()` calls to Moesif as [user actions](https://www.moesif.com/docs/getting-started/user-actions/?utm_source=segmentio\&utm_medium=docs\&utm_campaign=partners) which you can see in the *Events* section in Moesif. The integration maps event fields as follows:

| Segment Field | Moesif Field  |
| ------------- | ------------- |
| `event`       | `action_name` |
| `properties`  | `metadata`    |

## Engage

You can send computed traits and audiences generated using [Engage](/docs/segment/engage) to this destination as a **user property**. To learn more about Engage, schedule a [demo](https://segment.com/contact/demo).

For user-property destinations, an [identify](/docs/segment/connections/spec/identify/) call is sent to the destination for each user being added and removed. The property name is the snake\_cased version of the audience name, with a true/false value to indicate membership. For example, when a user first completes an order in the last 30 days, Engage sends an Identify call with the property `order_completed_last_30days: true`. When the user no longer satisfies this condition (for example, it's been more than 30 days since their last order), Engage sets that value to `false`.

When you first create an audience, Engage sends an Identify call for every user in that audience. Later audience syncs only send updates for users whose membership has changed since the last sync.

> \[!NOTE]
>
> Real-time audience syncs to Moesif API Analytics  may take six or more hours for the initial sync to complete. Upon completion, a sync frequency of two to three hours is expected.

## Settings

Segment lets you change these destination settings from the Segment app without having to touch any code.

| Field   | Description                                                                               | Required | Type   |
| ------- | ----------------------------------------------------------------------------------------- | -------- | ------ |
| API Key | You can find your API key by going to extensions menu within Moesif and selecting Segment | Yes      | string |
