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

# 记录弹窗已展示、已关闭或已提交

> POST /campaign/user-log/

在 **Management API** 主机（`api.scanova.io`）上为某个 G2 评价活动创建已认证账户的日志记录，使用您的原始 Management API 密钥进行身份验证。

```
POST https://api.scanova.io/campaign/user-log/
Authorization: 401f7ac837da42b97f613d789819ff93537bee6a
```

<ParamField body="g2_campaign" type="integer" required>
  活动的 `id`，来自 [`GET /campaign/active/`](/zh/api-reference/management-api/campaign/active)。
</ParamField>

<ParamField body="last_shown" type="string">
  弹窗展示给用户的时间，ISO 8601 时间戳。
</ParamField>

<ParamField body="last_dismissed" type="string">
  用户未提交而关闭弹窗的时间，ISO 8601 时间戳。
</ParamField>

<ParamField body="last_submitted" type="string">
  用户点击以留下评价的时间，ISO 8601 时间戳。
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.scanova.io/campaign/user-log/" \
    -H "Authorization: 401f7ac837da42b97f613d789819ff93537bee6a" \
    -H "Content-Type: application/json" \
    -d '{
      "g2_campaign": 4,
      "last_shown": "2026-08-20T10:15:00Z"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 201 theme={null}
  {
    "id": 118,
    "last_shown": "2026-08-20T10:15:00Z",
    "last_dismissed": null,
    "last_submitted": null,
    "is_popup_disabled": false
  }
  ```
</ResponseExample>

## 每个活动只有一条记录

每个（账户，活动）组合只存在一条日志记录。如果该账户针对传入的 `g2_campaign` 已经存在一条记录，此调用会返回 `400`，并附带纯文本错误消息（而非通常的字段级校验错误结构）——请改用[更新您的活动日志](/zh/api-reference/management-api/campaign/user-log-update)，而不是重试创建操作。

## 相关内容

* [获取当前有效的评价活动](/zh/api-reference/management-api/campaign/active)——找到要记录的 `g2_campaign` ID。
* [获取您对当前活动的关闭状态](/zh/api-reference/management-api/campaign/user-log-status)——读回此调用所创建的内容。
* [更新您的活动日志](/zh/api-reference/management-api/campaign/user-log-update)——在后续互动中更新此记录。
* [Management API 概览](/zh/api-reference/management-api/overview)——适用于此端点的身份验证方案和配额规则。


## OpenAPI

````yaml api-reference/openapi/management-api.json POST /campaign/user-log/
openapi: 3.1.0
info:
  title: Scanova Management API (v2)
  description: >-
    The complete Scanova Management API — every endpoint available at
    api.scanova.io (QR codes, folders, tags, leads, forms, analytics, plans,
    shared users & roles), plus the token-creation and usage-stats endpoints
    used to authenticate against it. Every path and request/response shape below
    was verified live against a real API key and the actual running backend
    (Phase 7, 2026-08-16) — not guessed from reading urls.py alone.
  version: 2.0.0
servers:
  - url: https://api.scanova.io
    description: Management API — QR/folder/tag/lead/form/analytics/plans endpoints
security:
  - apiKeyAuth: []
paths:
  /campaign/user-log/:
    post:
      summary: Log that the review popup was shown, dismissed, or submitted
      description: >-
        Creates the account's log row for a campaign, recording when the popup
        was shown, dismissed, or its review link clicked. One row per (account,
        campaign) — a second POST for a campaign this account already has a row
        for returns 400 with a plain-text message (not a validation-error
        object); use PATCH /campaign/user-log/{id}/ to update an existing row
        instead.
      operationId: createManagedCampaignUserLog
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                g2_campaign:
                  type: integer
                  description: The campaign's id, from GET /campaign/active/.
                last_shown:
                  type: string
                  format: date-time
                last_dismissed:
                  type: string
                  format: date-time
                last_submitted:
                  type: string
                  format: date-time
              required:
                - g2_campaign
            example:
              g2_campaign: 4
              last_shown: '2026-08-20T10:15:00Z'
      responses:
        '201':
          description: Log row created.
          content:
            application/json:
              example:
                id: 118
                last_shown: '2026-08-20T10:15:00Z'
                last_dismissed: null
                last_submitted: null
                is_popup_disabled: false
        '400':
          description: >-
            A log row for this account and campaign already exists — use PATCH
            instead.
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Send your Management API key as the raw value of the Authorization
        header — no "Bearer " or "Token " prefix, and no other characters.
        Example: `Authorization: 401f7ac837da42b97f613d789819ff93537bee6a`. A
        header containing more than one space-separated part is rejected
        outright. Requests also require the request's Host header to be the
        management API host (e.g. api.scanova.io) — the same key sent to the
        regular API host will not authenticate.

````