# club.foryou.getStats

> Published by [foryou.club](https://lexicon.garden/identity/did:plc:qhyg27lbj3uqsmlyvmsh2bjx)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:qhyg27lbj3uqsmlyvmsh2bjx/club.foryou.getStats)
- [Documentation](https://lexicon.garden/lexicon/did:plc:qhyg27lbj3uqsmlyvmsh2bjx/club.foryou.getStats/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:qhyg27lbj3uqsmlyvmsh2bjx/club.foryou.getStats/examples)

## Definitions

### `club.foryou.getStats#activity`

**Type**: `object`

The user's own usage of the For You feed.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `likesGiven` | `integer` | Yes |  |
| `postsViewed` | `integer` | Yes |  |
| `showLess` | `integer` | Yes |  |
| `showMore` | `integer` | Yes |  |
| `totalRequests` | `integer` | Yes |  |

### `club.foryou.getStats#author`

**Type**: `object`

How the user's own posts performed in the feed.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `topPosts` | `array` | Yes |  |
| `totalLikes` | `integer` | Yes |  |
| `totalViews` | `integer` | Yes |  |

### `club.foryou.getStats#curator`

**Type**: `object`

How the user's likes helped others: people who liked the same posts were shown what else the user liked.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `likesCreated` | `integer` | Yes |  |
| `topPosts` | `array` | Yes |  |
| `usersHelped` | `integer` | Yes |  |
| `viewsCreated` | `integer` | Yes |  |

### `club.foryou.getStats`

**Type**: `query`

Authenticated, read-only view of a user's own For You (foryou.club) stats. Requires an atproto service-auth JWT (Authorization: Bearer) with aud=did:web:foryou.club and lxm=club.foryou.getStats; the token's iss identifies the user whose stats are returned.

#### Parameters

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `days` | `integer` | No | Number of days to aggregate over. Defaults to the server's configured window. |

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `activity` | `ref` → `#activity` | Yes |  |
| `author` | `ref` → `#author` | Yes |  |
| `curator` | `ref` → `#curator` | Yes |  |
| `daysAnalyzed` | `integer` | Yes |  |
| `did` | `string` (did) | Yes | DID of the user these stats belong to. |
| `displayName` | `string` | No |  |
| `generatedAt` | `string` (datetime) | Yes |  |
| `handle` | `string` (handle) | No |  |

### `club.foryou.getStats#post`

**Type**: `object`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `likes` | `integer` | Yes |  |
| `uniqueViewers` | `integer` | No |  |
| `uri` | `string` (at-uri) | Yes |  |
| `url` | `string` (uri) | Yes |  |

## Raw Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "activity": {
      "description": "The user's own usage of the For You feed.",
      "properties": {
        "likesGiven": {
          "type": "integer"
        },
        "postsViewed": {
          "type": "integer"
        },
        "showLess": {
          "type": "integer"
        },
        "showMore": {
          "type": "integer"
        },
        "totalRequests": {
          "type": "integer"
        }
      },
      "required": [
        "totalRequests",
        "postsViewed",
        "likesGiven",
        "showMore",
        "showLess"
      ],
      "type": "object"
    },
    "author": {
      "description": "How the user's own posts performed in the feed.",
      "properties": {
        "topPosts": {
          "items": {
            "ref": "#post",
            "type": "ref"
          },
          "type": "array"
        },
        "totalLikes": {
          "type": "integer"
        },
        "totalViews": {
          "type": "integer"
        }
      },
      "required": [
        "totalViews",
        "totalLikes",
        "topPosts"
      ],
      "type": "object"
    },
    "curator": {
      "description": "How the user's likes helped others: people who liked the same posts were shown what else the user liked.",
      "properties": {
        "likesCreated": {
          "type": "integer"
        },
        "topPosts": {
          "items": {
            "ref": "#post",
            "type": "ref"
          },
          "type": "array"
        },
        "usersHelped": {
          "type": "integer"
        },
        "viewsCreated": {
          "type": "integer"
        }
      },
      "required": [
        "usersHelped",
        "viewsCreated",
        "likesCreated",
        "topPosts"
      ],
      "type": "object"
    },
    "main": {
      "description": "Authenticated, read-only view of a user's own For You (foryou.club) stats. Requires an atproto service-auth JWT (Authorization: Bearer) with aud=did:web:foryou.club and lxm=club.foryou.getStats; the token's iss identifies the user whose stats are returned.",
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "activity": {
              "ref": "#activity",
              "type": "ref"
            },
            "author": {
              "ref": "#author",
              "type": "ref"
            },
            "curator": {
              "ref": "#curator",
              "type": "ref"
            },
            "daysAnalyzed": {
              "type": "integer"
            },
            "did": {
              "description": "DID of the user these stats belong to.",
              "format": "did",
              "type": "string"
            },
            "displayName": {
              "type": "string"
            },
            "generatedAt": {
              "format": "datetime",
              "type": "string"
            },
            "handle": {
              "format": "handle",
              "type": "string"
            }
          },
          "required": [
            "did",
            "daysAnalyzed",
            "generatedAt",
            "activity",
            "curator",
            "author"
          ],
          "type": "object"
        }
      },
      "parameters": {
        "properties": {
          "days": {
            "description": "Number of days to aggregate over. Defaults to the server's configured window.",
            "maximum": 365,
            "minimum": 1,
            "type": "integer"
          }
        },
        "type": "params"
      },
      "type": "query"
    },
    "post": {
      "properties": {
        "likes": {
          "type": "integer"
        },
        "uniqueViewers": {
          "type": "integer"
        },
        "uri": {
          "format": "at-uri",
          "type": "string"
        },
        "url": {
          "format": "uri",
          "type": "string"
        }
      },
      "required": [
        "uri",
        "url",
        "likes"
      ],
      "type": "object"
    }
  },
  "id": "club.foryou.getStats",
  "lexicon": 1
}
```
