The Ranksy integration is a call from your Shopify app to the Ranksy `/identify` endpoint. Your app makes the call when a merchant installs or opens your app. The call tells Ranksy about the store: its Shopify plan, its location, its contacts, and the merchant's device.

The Partner API and BigQuery give Ranksy your revenue and your traffic. They do not give Ranksy the store details. Only your app knows them. The `/identify` call is how your app sends them.

## What needs the Ranksy integration

These features need `/identify` calls from your app:

| Feature | What `/identify` adds |
| --- | --- |
| [Meta Ads Attribution](https://docs.ranksyapp.com/hc/docs/articles/meta-ads-attribution) and Reddit conversions | The Shopify plan of each store. **Ranksy sends no install conversions for a store with no plan data.** The IP address and user agent match installs to ad clicks. |
| [Ad Landing Pages](https://docs.ranksyapp.com/hc/docs/articles/ad-landing-pages) | The merchant device that Ranksy matches to the clicks on your ad links. |
| [Affiliate tracking](https://docs.ranksyapp.com/hc/docs/articles/affiliate-tracking-setup) | The `mref` referral code and the merchant device. You need `/identify` or GA4 through BigQuery. |
| **Store profile** filters on the Revenue, Traffic and CRM pages | Shopify plan, country, store type (Shopify Plus) and store age. With no `/identify` data, the filter shows **View setup guide** in place of the filter values. |
| [CRM](https://docs.ranksyapp.com/hc/docs/articles/customer-management) store profile | Contacts, owner name, phone, address, timezone, currency, tags and custom fields. |
| **Last seen** in the CRM | The time of the last `/identify` or `/track` call for the store. |
| [CRM Automations](https://docs.ranksyapp.com/hc/docs/articles/crm-automations) | The **Inactive customer** and **Health drop** triggers fire only for stores with tracked activity (`/identify` or `/track`). |
| [Activity and Usage Events](https://docs.ranksyapp.com/hc/docs/articles/activity-and-usage-events) | `/track` events. `/track` is part of the same integration and uses the same API key. |

These features do **not** need `/identify`: rankings, keywords, competitors, the Revenue hub totals (Partner API) and the Traffic hub (BigQuery).

To see the full list of features and the connection that each one needs, read [Which Features Need Which Connection](https://docs.ranksyapp.com/hc/docs/articles/integration-requirements).

## Before you start

- Your app is in **My Apps** in Ranksy. See [Add App to My Apps](https://docs.ranksyapp.com/hc/docs/articles/add-app-to-my-apps).
- Connect the [Partner API](https://docs.ranksyapp.com/hc/docs/articles/connect-partner-api). Ranksy joins the store data from `/identify` with the installs and charges from the Partner API. Most features in the table above also need the Partner API.
- You have permission to manage integrations in your team.

## Step 1: Create an API key

Only the team owner can create API keys.

1. Open **Settings** > **API Keys**.
2. Create a key with the `crm:write` scope.
3. Copy the key. Keep it on your server. Do not put the key in browser code.

For more about keys and scopes, see [Developer API](https://docs.ranksyapp.com/hc/docs/articles/developer-api).

## Step 2: Find your Ranksy app ID

Call `GET https://ranksyapp.com/api/v1/apps` with your key. Use the `ulid` of your app in the `/identify` URL. The key needs the `apps:read` scope for this call.

## Step 3: Call /identify from your app's server

Call `/identify` when a merchant installs your app. Call it again when the merchant opens your app, so that the data stays current.

```js
await fetch(`https://ranksyapp.com/api/v1/apps/${RANKSY_APP_ID}/identify`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RANKSY_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    myshopify_domain: session.shop,             // required, e.g. "acme.myshopify.com"
    shopify_access_token: session.accessToken,  // or send shop_id with a shop object
    contacts: [
      {
        email: shopOwnerEmail,
        ip: merchantIp,                          // the merchant's IP address
        user_agent: merchantUserAgent,           // the merchant's browser user agent
      },
    ],
  }),
});
```

You can send the store data in one of two ways:

| Option | What you send | What Ranksy does |
| --- | --- | --- |
| **Token** | `shopify_access_token` | Ranksy reads the store plan, address and timezone from the Shopify Admin API. |
| **Data** | `shop_id` and a `shop` object (for example `plan_display_name`, `country`, `store_created_at`, `is_shopify_plus`) | Ranksy keeps the data that you send. Ranksy makes no call to Shopify. |

You can also send `tags`, `custom_fields` and up to 100 `contacts`. For affiliate tracking, send `mref`. The [identify API reference](https://api.ranksyapp.com/identify) lists all the fields.

⚠️ **Warning:** Send the merchant's IP address and user agent, as your app saw them in the merchant's browser. Do not send the IP address of your own server. Ranksy uses these values to match installs to ad clicks and referral clicks.

## Step 4: Send activity with /track (optional)

Call `/identify` when the merchant installs or opens your app. Call `/track` when the merchant uses your app. `/track` is small and fast. It updates **Last seen** and records activity and usage events. See [Activity and Usage Events](https://docs.ranksyapp.com/hc/docs/articles/activity-and-usage-events).

## Check that the integration works

- **API response**: a successful call returns `200`. A call with an error returns `422` and an error code.
- **CRM**: open a store in **CRM** > **Customers**. The store profile shows the plan, the country and the contacts that you sent.
- **Store profile filter**: open a Revenue tab and open the filter menu. The **Store profile** section shows how many installs have store data.
- **Affiliates**: the **Tracking setup** card shows **identify calls** as passed when Ranksy received a call in the last 30 days.

## Limits

- Calls to `/identify`, `/track` and `/capi` do not count toward the monthly API request limit of your plan.
- These calls are not rate limited, because apps call them on each merchant page view.

## FAQ

**Q: Do I need /identify if I connected the Partner API and BigQuery?**

A: Only for the features in the table above. Revenue, traffic and rankings work without it.

**Q: Can I send old stores?**

A: Yes. Call `/identify` for each store that has your app installed. Ranksy updates the existing CRM record of the store.

**Q: My app does not have an access token for the store.**

A: Use the data option. Send `shop_id` and a `shop` object with the fields that you have.

## Next steps

- [Which Features Need Which Connection](https://docs.ranksyapp.com/hc/docs/articles/integration-requirements) — See the requirements of each feature.
- [Developer API](https://docs.ranksyapp.com/hc/docs/articles/developer-api) — Create API keys and read the other endpoints.
- [Meta Ads Attribution](https://docs.ranksyapp.com/hc/docs/articles/meta-ads-attribution) — Send conversions to Meta.
- [Affiliate Tracking Prerequisites](https://docs.ranksyapp.com/hc/docs/articles/affiliate-tracking-setup) — Send `mref` with `/identify`.