{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/linkinseconds-com/json-schema/linkinseconds-com-analytics-report-schema.json",
  "title": "AnalyticsReport",
  "description": "The same report the dashboard renders. All dates are UTC; range.to is exclusive. Bots and link previews are excluded and counted in totals.botsExcluded. Atypical sessions (bots, email scanners, link previews) are counted in totals.atypical, flagged in recent[].atypical and kept out of every average. Engagement fields come from the viewer's session and are 0 for opens recorded before engagement tracking existed.",
  "x-generated": "2026-11-17",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/linkinseconds-com-openapi.json#/components/schemas/AnalyticsReport",
  "type": "object",
  "properties": {
    "range": {
      "type": "object",
      "properties": {
        "key": {
          "type": "string",
          "enum": [
            "7d",
            "14d",
            "30d",
            "90d",
            "all"
          ]
        },
        "from": {
          "type": "string",
          "format": "date-time"
        },
        "to": {
          "type": "string",
          "format": "date-time"
        },
        "days": {
          "type": "integer"
        },
        "label": {
          "type": "string"
        }
      }
    },
    "totals": {
      "type": "object",
      "properties": {
        "views": {
          "type": "integer"
        },
        "uniques": {
          "type": "integer"
        },
        "sessions": {
          "type": "integer",
          "description": "Opens with engagement data"
        },
        "avgEngagedMs": {
          "type": "integer"
        },
        "medianEngagedMs": {
          "type": "integer"
        },
        "totalEngagedMs": {
          "type": "integer"
        },
        "completionPct": {
          "type": [
            "number",
            "null"
          ],
          "description": "Pages reached, media played or scroll depth, by file kind"
        },
        "downloads": {
          "type": "integer",
          "description": "All-time, not windowed"
        },
        "qrScans": {
          "type": "integer"
        },
        "returningPct": {
          "type": "number"
        },
        "bouncePct": {
          "type": "number",
          "description": "Opens under 5 engaged seconds"
        },
        "botsExcluded": {
          "type": "integer"
        },
        "atypical": {
          "type": "integer",
          "description": "Sessions by a bot, email scanner or link preview: counted and listed, not in sessions or any average"
        }
      }
    },
    "previous": {
      "type": "object",
      "description": "The same width of time before the range"
    },
    "deltas": {
      "type": "object",
      "properties": {
        "views": {
          "type": "object",
          "properties": {
            "pct": {
              "type": [
                "integer",
                "null"
              ],
              "description": "Signed percent change vs the previous period; null when the previous period was 0"
            },
            "dir": {
              "type": "string",
              "enum": [
                "up",
                "down",
                "flat"
              ]
            }
          },
          "required": [
            "pct",
            "dir"
          ]
        },
        "uniques": {
          "type": "object",
          "properties": {
            "pct": {
              "type": [
                "integer",
                "null"
              ],
              "description": "Signed percent change vs the previous period; null when the previous period was 0"
            },
            "dir": {
              "type": "string",
              "enum": [
                "up",
                "down",
                "flat"
              ]
            }
          },
          "required": [
            "pct",
            "dir"
          ]
        },
        "avgEngagedMs": {
          "type": "object",
          "properties": {
            "pct": {
              "type": [
                "integer",
                "null"
              ],
              "description": "Signed percent change vs the previous period; null when the previous period was 0"
            },
            "dir": {
              "type": "string",
              "enum": [
                "up",
                "down",
                "flat"
              ]
            }
          },
          "required": [
            "pct",
            "dir"
          ]
        },
        "downloads": {
          "type": "object",
          "properties": {
            "pct": {
              "type": [
                "integer",
                "null"
              ],
              "description": "Signed percent change vs the previous period; null when the previous period was 0"
            },
            "dir": {
              "type": "string",
              "enum": [
                "up",
                "down",
                "flat"
              ]
            }
          },
          "required": [
            "pct",
            "dir"
          ]
        }
      }
    },
    "granularity": {
      "type": "string",
      "enum": [
        "day",
        "week"
      ]
    },
    "series": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "format": "date"
          },
          "label": {
            "type": "string"
          },
          "views": {
            "type": "integer"
          },
          "uniques": {
            "type": "integer"
          },
          "avgEngagedS": {
            "type": "integer"
          }
        }
      }
    },
    "breakdowns": {
      "type": "object",
      "properties": {
        "countries": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "key": {
                "type": "string"
              },
              "count": {
                "type": "integer"
              },
              "pct": {
                "type": "number",
                "description": "Share of the total, 0 to 100"
              }
            },
            "required": [
              "key",
              "count",
              "pct"
            ]
          }
        },
        "cities": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "key": {
                "type": "string"
              },
              "count": {
                "type": "integer"
              },
              "pct": {
                "type": "number",
                "description": "Share of the total, 0 to 100"
              }
            },
            "required": [
              "key",
              "count",
              "pct"
            ]
          }
        },
        "referrers": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "key": {
                "type": "string"
              },
              "count": {
                "type": "integer"
              },
              "pct": {
                "type": "number",
                "description": "Share of the total, 0 to 100"
              }
            },
            "required": [
              "key",
              "count",
              "pct"
            ]
          }
        },
        "sources": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "key": {
                "type": "string"
              },
              "count": {
                "type": "integer"
              },
              "pct": {
                "type": "number",
                "description": "Share of the total, 0 to 100"
              }
            },
            "required": [
              "key",
              "count",
              "pct"
            ]
          }
        },
        "devices": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "key": {
                "type": "string"
              },
              "count": {
                "type": "integer"
              },
              "pct": {
                "type": "number",
                "description": "Share of the total, 0 to 100"
              }
            },
            "required": [
              "key",
              "count",
              "pct"
            ]
          }
        },
        "browsers": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "key": {
                "type": "string"
              },
              "count": {
                "type": "integer"
              },
              "pct": {
                "type": "number",
                "description": "Share of the total, 0 to 100"
              }
            },
            "required": [
              "key",
              "count",
              "pct"
            ]
          }
        },
        "os": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "key": {
                "type": "string"
              },
              "count": {
                "type": "integer"
              },
              "pct": {
                "type": "number",
                "description": "Share of the total, 0 to 100"
              }
            },
            "required": [
              "key",
              "count",
              "pct"
            ]
          }
        },
        "screens": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "key": {
                "type": "string"
              },
              "count": {
                "type": "integer"
              },
              "pct": {
                "type": "number",
                "description": "Share of the total, 0 to 100"
              }
            },
            "required": [
              "key",
              "count",
              "pct"
            ]
          }
        }
      }
    },
    "timing": {
      "type": "object",
      "properties": {
        "byHour": {
          "type": "array",
          "items": {
            "type": "integer"
          },
          "minItems": 24,
          "maxItems": 24
        },
        "byWeekday": {
          "type": "array",
          "items": {
            "type": "integer"
          },
          "minItems": 7,
          "maxItems": 7,
          "description": "Sunday first"
        },
        "heat": {
          "type": "array",
          "items": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          },
          "description": "[weekday][hour]"
        },
        "peakHour": {
          "type": [
            "integer",
            "null"
          ]
        },
        "peakWeekday": {
          "type": [
            "integer",
            "null"
          ]
        }
      }
    },
    "content": {
      "type": "object",
      "description": "kind: pages (PDF), media (video, audio), scroll (pages, images, text) or none. pages carries dropoff {afterPage, lostPct} and media.dropoff {beforePct, lostPct}, null until at least 3 sessions and a loss of 10 points"
    },
    "insights": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "value": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          },
          "tone": {
            "type": "string",
            "enum": [
              "good",
              "neutral",
              "warn"
            ]
          }
        }
      }
    },
    "recent": {
      "type": "array",
      "description": "The 25 most recent opens with engagement data",
      "items": {
        "type": "object"
      }
    }
  }
}