# Ghi lại lượt xem paywall

> Adapty có thể giúp bạn đo lường tỷ lệ chuyển đổi của các paywall. Tuy nhiên, để làm được điều đó,
> bạn cần ghi lại thời điểm paywall được hiển thị — nếu không, chúng tôi chỉ
> biết về những người dùng đã mua hàng và bỏ lỡ những người chưa mua.
> Sử dụng yêu cầu này để ghi lại lượt xem paywall.

## OpenAPI

```yaml
/api-specs/web-api.yaml post /api/v2/web-api/paywall/visit/
openapi: 3.1.0
info:
  title: Adapty Web API
  version: 1.0.0
  description: |
    Adapty Web API cho phép bạn tích hợp nền tảng quản lý gói đăng ký của Adapty
    vào các ứng dụng web của bạn. API này cung cấp các endpoint để lấy paywall,
    ghi lại lượt xem paywall và thêm dữ liệu attribution.
servers:
  - url: https://api.adapty.io
    description: Máy chủ production
security:
  - apikeyAuth: []
paths:
  /api/v2/web-api/paywall/visit/:
    post:
      summary: Ghi lại lượt xem paywall
      description: |
        Adapty có thể giúp bạn đo lường tỷ lệ chuyển đổi của các paywall. Tuy nhiên, để làm được điều đó,
        bạn cần ghi lại thời điểm paywall được hiển thị — nếu không, chúng tôi chỉ
        biết về những người dùng đã mua hàng và bỏ lỡ những người chưa mua.
        Sử dụng yêu cầu này để ghi lại lượt xem paywall.
      operationId: recordPaywallView
      security:
        - apikeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RecordPaywallViewRequest"
            examples:
              basic:
                summary: Ghi lại lượt xem paywall cơ bản
                value:
                  visited_at: "2024-08-24T14:15:22Z"
                  store: app_store
                  variation_id: 00000000-0000-0000-0000-000000000000
                  customer_user_id: user123
      responses:
        "201":
          description: Lượt xem paywall được ghi lại thành công.
          content:
            application/json:
              schema:
                type: object
                description: Nội dung phản hồi rỗng
        "400":
          description: Yêu cầu không hợp lệ
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/InvalidDateFormatError"
        "401":
          description: Không được phép
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UnauthorizedError"
        "404":
          description: Không tìm thấy
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ProfileNotFoundError"
components:
  schemas:
    RecordPaywallViewRequest:
      type: object
      required:
        - store
        - variation_id
      properties:
        customer_user_id:
          type: string
          description: Mã định danh của người dùng trong hệ thống của bạn. Bắt buộc có `customer_user_id` hoặc `profile_id`.
          example: user123
        profile_id:
          type: string
          description: Mã định danh của người dùng trong Adapty. Bắt buộc có `customer_user_id` hoặc `profile_id`.
          example: 3286abd3-48b0-4e9c-a5f6-ac0a006804a6
        visited_at:
          type: string
          format: date-time
          description: Ngày giờ khi người dùng mở paywall.
          example: "2024-08-24T14:15:22Z"
        store:
          type: string
          description: |
            Cửa hàng nơi sản phẩm được mua. Các giá trị có thể: `app_store`, `play_store`, `stripe`, hoặc `Store ID` của cửa hàng tùy chỉnh của bạn.
          example: app_store
        variation_id:
          type: string
          format: uuid
          description: ID biến thể được dùng để theo dõi các giao dịch mua hàng liên kết với paywall cụ thể đó.
          example: 00000000-0000-0000-0000-000000000000
    InvalidDateFormatError:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              source:
                type: string
              errors:
                type: array
                items:
                  type: string
        error_code:
          type: string
        status_code:
          type: integer
    UnauthorizedError:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              source:
                type: string
              errors:
                type: array
                items:
                  type: string
        error_code:
          type: string
        status_code:
          type: integer
    ProfileNotFoundError:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              source:
                type: string
              errors:
                type: array
                items:
                  type: string
        error_code:
          type: string
        status_code:
          type: integer
  securitySchemes:
    apikeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: |
        Các yêu cầu API phải được xác thực bằng public API key của bạn trong header **Authorization**
        với giá trị `Api-Key {your_public_api_key}`, ví dụ:
        `Api-Key public_live_...`. Tìm key này trong Adapty Dashboard ->
        **App Settings** -> tab **General** -> mục **API keys**.
```
