# X link clicks in the PubNio analytics API

X lists link clicks (`url_link_clicks`) and profile visits (`user_profile_clicks`) as non-public metrics. PubNio reads them only for posts up to 30 days old. After that they return `unsupported` with reason `non_public_metrics_expired`, even when earlier reads stored a value; if X refuses the fields, PubNio rereads public counts only. Provider facts checked 2026-12-05.

## What PubNio returns

| Metric | Scope | X field | Unit | Combines by |
| --- | --- | --- | --- | --- |
| `link_clicks` | post | `url_link_clicks` (non-public; posts up to 30 days old only) | count | sum |
| `link_clicks` | account | sum of posts' `url_link_clicks` (non-public) | count | sum |
| `profile_visits` | post | `user_profile_clicks` (non-public; posts up to 30 days old only) | count | sum |
| `profile_visits` | account | sum of posts' `user_profile_clicks` (non-public) | count | sum |

`link_clicks`: Outbound or website link clicks.

`profile_visits`: Profile visits attributed to the post or account.

## How PubNio reads it

- X's reference says “Non-public, organic, and promoted metrics are only available for posts created within the last 30 days.” PubNio's adapter uses the same 30 days: after it, the read asks for public fields only and marks both metrics expired.
- A value stored while the post was inside the 30 days is not returned afterwards: the stored expired marker takes precedence over the stored number, so the API answers `unsupported` with a null value.
- The retry happens once, only when X answers the first read with an invalid-request or permission error, and then the reason is `non_public_metrics_unavailable`. Public counts (impressions, likes, replies, reposts, quotes, bookmarks) keep updating for the whole post window.
- Account link clicks add the `url_link_clicks` of each post created in the range that carries one; a post without the non-public count adds nothing.

## Example

The capabilities endpoint answers without calling X. Under the X provider, these are its entries for `link_clicks`.

```http
GET /api/v1/workspaces/4e5f6a7b-8c9d-4e0f-9a1b-2c3d4e5f6a7b/analytics/capabilities
Authorization: Bearer pn_live_***
```

```json
[
  {
    "key": "link_clicks",
    "scope": "post",
    "granularity": "day",
    "unit": "count",
    "aggregation": "sum",
    "availability": "available",
    "supported": true,
    "renamedFrom": "url_link_clicks"
  },
  {
    "key": "link_clicks",
    "scope": "account",
    "granularity": "day",
    "unit": "count",
    "aggregation": "sum",
    "availability": "available",
    "supported": true
  }
]
```

## Limits

- An account `link_clicks` total is the last daily read's value for its window, 30 days before the read through the day of the read, whatever `from` and `to` the request names. Per-day values come from the daily series, which the workspace plan bounds.
- A metric X does not report comes back with `value: null` and an availability state that says why. A post with no stored values whose last read failed on permissions, a rate limit, or a transient error answers with that error instead.

## Sources

- [X API: Metrics](https://docs.x.com/x-api/fundamentals/metrics), read 2026-12-05

## Related

- [X (Twitter) analytics API: the metrics PubNio reads](https://pubnio.com/platforms/x/analytics)
- [X OAuth scopes](https://pubnio.com/docs/providers/x/scopes/)
- [API reference: analytics capabilities](https://pubnio.com/docs/reference/analytics-capabilities-get/)

