> ## Documentation Index
> Fetch the complete documentation index at: https://docs.partnero.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Register click

> Count a referral link click from your server so it appears in partner and link click statistics — for sites that don't run PartneroJS.

## Endpoint

```
POST https://api.partnero.com/v1/analytics/register_click
```

Records a click on a partner's referral link. Registered clicks appear in the partner's click count, referral link clicks, the **Click activity** report, and the partner portal.

Use this endpoint when you track referrals without the [PartneroJS snippet](https://docs.partnero.com/guides/tracking/javascript-tracking.md) — for example a [server-to-server integration](https://docs.partnero.com/guides/tracking/server-to-server.md), a mobile app, or a site using [postback URL tracking](https://docs.partnero.com/guides/postbacks/postback-url-tracking.md). PartneroJS counts clicks automatically, so you don't need this endpoint if the snippet is installed.

> [!WARNING]
>
> Clicks are only counted by PartneroJS or this endpoint. Referral link redirects through a tracking domain and the keyless click registration endpoint (`/pub/v1/s2s/clicks/{pub_id}`) generate a postback click ID, but they don't add to click statistics. If you rely on either of them without PartneroJS, call this endpoint as well.

## Request body

| Parameter | Type | Required | Description |
| - | - | - | - |
| `referral_key` | string | Yes | The referral key from the landing URL (for example `john` from `?aff=john`). Accepts a partner's default key or the key of any of their custom referral links; the click is counted on the matching link |
| `url` | string | Yes | The full landing page URL the visitor arrived on, including the query string. Must be a valid absolute URL. Query parameters your program tracks (such as UTM tags) are recorded from it |

## Request

```bash cURL theme={"system"}
curl --location 'https://api.partnero.com/v1/analytics/register_click' \
  --header 'Content-Type: application/json' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --data '{
    "referral_key": "john",
    "url": "https://your-site.com/pricing?aff=john&utm_source=newsletter"
  }'
```

## Response

```json 200 OK theme={"system"}
{
  "status": 1
}
```

Clicks are processed in the background, so the response is always `{"status": 1}` once the request is accepted — including when the referral key doesn't match a partner, or `url` is missing or invalid. Those clicks are silently discarded. Processed clicks usually appear in statistics within a minute.

## Usage notes

* **Call it once per referred landing**, not on every page view. Each request counts as one click; there is no deduplication.
* **Only call it for referred visits** — when the landing URL contains your program's referral parameter.
* **Call it from your backend.** The endpoint requires your secret API key, which must never be exposed in browser or mobile code.

```javascript theme={"system"}
app.get('*', async (req, res, next) => {
  const aff = req.query.aff;

  if (aff && !req.session.partneroClickRegistered) {
    req.session.affiliateKey = aff;
    req.session.partneroClickRegistered = true;

    fetch('https://api.partnero.com/v1/analytics/register_click', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        'Authorization': `Bearer ${process.env.PARTNERO_API_KEY}`
      },
      body: JSON.stringify({
        referral_key: aff,
        url: `${req.protocol}://${req.get('host')}${req.originalUrl}`
      })
    }).catch(() => {});
  }

  next();
});
```

Registering a click doesn't attribute anything by itself. You still need to store the referral key and send it with [Create customer](https://docs.partnero.com/api-reference/customers/create.md) at sign-up, or send the click ID in a [postback](https://docs.partnero.com/guides/postbacks/postback-url-tracking.md#the-postback-endpoint).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.