Ranksy records two different kinds of event about your merchants — **activity** and **usage**. This guide explains the difference, how to send each one, and where each shows up in Ranksy.

## Requirements

- **Ranksy integration: required.** Your app sends events with the `/track` endpoint, part of the [Ranksy integration](https://docs.ranksyapp.com/hc/docs/articles/identify-integration). Also call `/identify` so that each merchant has a full store profile.
- **Shopify Partner API: not required.** The **Usage Events** tab works without it. Usage revenue (money) is on the [Usage](https://docs.ranksyapp.com/hc/docs/articles/usage-revenue) tab and needs the Partner API.
- **Permission**: your role needs the **Usage Events** permission to see the Usage Events tab.

## The Two Kinds of Event

Both come in through the same `/track` call of the [Developer API](https://docs.ranksyapp.com/hc/docs/articles/developer-api). What separates them is one field: `event_handle`.

| Detail | Activity | Usage |
| --- | --- | --- |
| **Answers** | How a merchant *uses* your app | What your app *does* for the merchant |
| **Examples** | Opened the app, viewed a page, changed a setting | Messages sent, orders synced, an email campaign fired |
| **Sent with** | A `type` (no `event_handle`) | An `event_handle`, usually a numeric `value` |
| **API key scopes** | `crm:write` | `crm:write` and `appevents:write` |
| **Shows up in** | The event list on the **Usage Events** tab of the [customer page](https://docs.ranksyapp.com/hc/docs/articles/customer-management), plus **Last seen** | The totals on the customer's **Usage Events** tab, the customer's **Shopify Events** tab, and the **Usage Events** tab of the [Revenue hub](https://docs.ranksyapp.com/hc/docs/articles/revenue-dashboard) |
| **Countable / billable** | No | Yes — counted and summed |
| **Can reach Shopify** | Never | Optionally, if you forward it |

The short version: activity is your product-analytics stream (think Mixpanel), and usage is your metering stream (the numbers you'd bill or report on).

## Activity Events

Activity events track how a merchant moves through your app — opened it, opened the dashboard, changed a setting. They're lightweight, and you'd typically send one on every page load.

Send an activity event by calling `/track` with a `type` and no `event_handle`:

```json
{
  "myshopify_domain": "store.myshopify.com",
  "type": "dashboard_viewed",
  "meta": { "page": "/dashboard" }
}
```

`type` defaults to `app_opened` if you leave it out, so a bare `/track` call already counts as "the merchant opened the app". The `meta` object is free-form context, stored as-is.

Where it shows up:

- **Usage Events** tab of the customer page — a list of the activity events of the merchant, most recent first. The list is below the usage totals.
- **Last seen** — every `/track` call, activity or usage, updates the merchant's last-seen time. You'll see it on the customer record and can sort and filter your CRM by it.

To read activity events with the API, use `GET /apps/{app}/usage-events`. The name of the endpoint says "usage", but the endpoint returns the activity events, with their `type` and `meta`.

**Note:** Activity events stay inside Ranksy. They're never sent to Shopify.

## Usage Events

Usage events track what your app did *for* the merchant — the things you'd count, report on, or bill for. Messages sent, orders synced, emails delivered.

Send a usage event by calling `/track` with an `event_handle` and, usually, a numeric `value`:

```json
{
  "myshopify_domain": "store.myshopify.com",
  "event_handle": "messages_sent",
  "attributes": { "value": 12 }
}
```

Your API key needs the `appevents:write` scope for usage events. If the key does not have this scope, Ranksy does not record the event. The response then shows `"status": "skipped"`.

The `value` is what Ranksy sums. Send `messages_sent` with a value of `12` a hundred times over a month and the **Usage Events** tab shows a count of 100 events and a total of 1,200 messages.

Where it shows up:

- **Usage Events** tab of the customer page — totals for each event handle for that one merchant, and a **Usage over time** chart.
- **Shopify Events** tab of the customer page — each usage event of that merchant, with its value and its forwarding status.
- **Usage Events** tab of the Revenue hub — totals across every merchant. You can filter by event type and by date range. To filter by shop, use the `/usage-metrics` API endpoint.

Usage events also carry the merchant's identity forward correctly, so a message sent by *store A* is counted against store A and never mixed up with store B.

### Sending Usage to Shopify (Optional)

Usage events can be forwarded to Shopify's App Events API, where they can feed a usage-based billing meter you've set up on your app. This is optional — leave it off and the event is still recorded in Ranksy.

To forward, include an `app_events_token` (an app-level JWT you mint from your Shopify Dev Dashboard credentials) on the `/track` call. The full mint-and-forward flow is in the [API reference](https://api.ranksyapp.com/track#getting-an-app-events-token).

The token is valid for 60 minutes. If the token has expired, Ranksy rejects the call with `422` (`app_events_token_expired`). Ranksy then records nothing. Make a new token, then send the call again.

⚠️ **Warning:** Don't put personal data in a usage event's `attributes` — no names, emails, phone numbers, or customer IDs. Shopify's App Events terms prohibit it, and Ranksy forwards your attributes as-is. Use non-identifying values like a campaign, a plan, or a count.

## How Ranksy Decides Which Is Which

One field decides it: `event_handle`.

- **No `event_handle`** → activity. The `type` and `meta` are recorded as an activity event.
- **An `event_handle` is present** → usage. It's counted, summed, and optionally forwarded.

A single `/track` call is one or the other, never both. If you send an `event_handle`, the `type` and `meta` fields are ignored — a usage event is never also logged as activity, so one tracked action never double-counts.

## FAQ

**I sent `messages_sent` as a `type` and it does not show in my usage totals. Why?**

Because a `type` is an *activity* event. Ranksy records it as activity, not in the usage store, so it's never counted. To count it, send it as an `event_handle` with a `value` instead. Also make sure that your API key has the `appevents:write` scope.

```json
{
  "myshopify_domain": "store.myshopify.com",
  "event_handle": "messages_sent",
  "attributes": { "value": 1 }
}
```

**Can one call record both an activity and a usage event?**

No. Send two separate `/track` calls if you want both.

**Does my activity data go to Shopify?**

No. Only usage events can be forwarded, and only when you choose to by sending an `app_events_token`. Activity events never leave Ranksy.

**Do I need Shopify's developer preview to send usage events?**

No. Usage events are recorded in Ranksy — and forwarded to the Shopify Dev Dashboard, if you forward them — without any preview. The preview only matters for one specific case: showing *standard* Shopify events in the merchant-facing Shopify Analytics. See the [API reference](https://api.ranksyapp.com/track#where-forwarded-events-land) for that distinction.

**What counts as a "standard" vs "custom" usage event?**

A handle from Shopify's standard registry (it starts with `shopify.`, like `shopify.marketing.email_sent`) is a standard event and is validated against that registry. Any other handle — like `messages_sent` or `orders_synced` — is a custom usage event, recorded with no schema check. Ranksy counts both kinds in your usage totals.

## Next steps

- [Ranksy Integration: Send Store Data with /identify](https://docs.ranksyapp.com/hc/docs/articles/identify-integration) — Set up the integration that `/track` is part of.
- [Track endpoint — API reference](https://api.ranksyapp.com/track) — See the full `/track` request, both event kinds, and how to mint an `app_events_token`.
- [Usage Metrics endpoint — API reference](https://api.ranksyapp.com/usage-metrics) — Read your usage totals back over the API.
- [Developer API](https://docs.ranksyapp.com/hc/docs/articles/developer-api) — Create an API key with the `crm:write` and `appevents:write` scopes.
- [CRM](https://docs.ranksyapp.com/hc/docs/articles/customer-management) — See the events of each merchant on the customer page.
- [Connect Partner API](https://docs.ranksyapp.com/hc/docs/articles/connect-partner-api) — Sync revenue and subscription data alongside your events.