Files
cwd/docs/api/public/analytics/track-visit.md
anghunk 0b28c9fa4c docs: 更新API文档结构并完善功能说明
- 重构API文档侧边栏,将公开API拆分为子分类(评论、点赞、配置、身份验证、访问统计)
- 新增详细的公开API接口文档,包括评论管理、点赞功能、配置获取、身份验证和访问统计
- 完善数据统计功能文档,增加概览数据、访问明细和数据分析说明
- 更新功能设置文档,补充图片预览和个性化设置说明
- 修正管理员登录文档中的错误描述和格式问题
2026-02-06 17:55:31 +08:00

1.4 KiB
Raw Blame History

记录页面访问

POST /api/analytics/visit

前端组件在加载时调用此接口,记录页面访问数据,用于后台访问统计分析。

  • 方法:POST
  • 路径:/api/analytics/visit
  • 鉴权:不需要

请求头

名称 必填 示例
Content-Type application/json

请求体

{
  "postSlug": "https://example.com/blog/hello-world",
  "postTitle": "博客标题",
  "postUrl": "https://example.com/blog/hello-world"
}

字段说明:

字段名 类型 必填 说明
postSlug string 文章唯一标识符,window.location.origin + window.location.pathname
postTitle string 文章标题,用于后台展示页面名称
postUrl string 文章 URL用于后台展示页面链接和域名统计

成功响应

  • 状态码:200
{
  "success": true
}

错误响应

  • 缺少 postSlug

    • 状态码:400
    {
      "message": "postSlug is required"
    }
    
  • 服务器内部错误:

    • 状态码:500
    {
      "message": "记录访问数据失败"
    

! }