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

# Analytics de um produto

> Totais, funil, dia a dia, origens, formas de pagamento, ofertas e WhatsApp de um produto.

#### Escopo

```bash theme={null}
    read analytics
```

É o mesmo painel do produto no Cakto Analytics. O `product_id` é o `id` de [Listar produtos](https://docs.cakto.com.br/api-reference/products/list.md) ou de `products[].id` em [Todos os produtos](https://docs.cakto.com.br/api-reference/analytics/overview-all.md).


## OpenAPI

````yaml GET /public_api/analytics/products/{product_id}/
openapi: 3.0.3
info:
  title: Cakto API
  version: 1.0.0
  description: Documentação da API pública do Cakto.
servers:
  - url: https://api.cakto.com.br
    description: Cakto API
security: []
paths:
  /public_api/analytics/products/{product_id}/:
    get:
      tags:
        - analytics
      summary: Analytics de um produto
      description: >-
        O painel do produto: totais e período anterior, funil (página de vendas
        → checkout → formulário → pagamento → venda), dia a dia, origens (UTM,
        afiliado, país, aparelho), formas de pagamento, motivos de recusa, order
        bump, upsell e downsell, e o WhatsApp de recuperação. Até 12 meses por
        consulta.
      operationId: analytics_product
      parameters:
        - in: path
          name: product_id
          schema:
            type: string
          description: ID do produto.
          required: true
        - in: query
          name: startDate
          schema:
            type: string
            format: date
          description: >-
            Primeiro dia do período (`AAAA-MM-DD`, horário de Brasília). Sem
            ele, o período termina em `endDate` e tem 30 dias.
        - in: query
          name: endDate
          schema:
            type: string
            format: date
          description: >-
            Último dia do período, incluído (`AAAA-MM-DD`). Sem ele, hoje. O
            período vai até 12 meses (366 dias).
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnalyticsProduct'
              examples:
                Produto sem o Meta conectado:
                  $ref: '#/components/examples/AnalyticsProductExample'
          description: ''
        '400':
          description: Período ou plataforma inválidos.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnalyticsError'
              examples:
                Data inválida:
                  value:
                    detail: Datas inválidas. Use YYYY-MM-DD.
                Período invertido:
                  value:
                    detail: startDate maior que endDate.
                Acima de 12 meses:
                  value:
                    detail: Intervalo máximo de 366 dias.
                Plataforma inválida:
                  value:
                    detail: Plataforma inválida.
        '401':
          description: Request não autenticado devido à ausência ou invalidez do token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthenticatedError'
              examples:
                Token ausente ou inválido:
                  $ref: '#/components/examples/UnauthenticatedErrorExample'
        '403':
          description: >-
            O token não tem o escopo `analytics`, ou o Cakto Analytics não está
            liberado para a conta.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnalyticsError'
              examples:
                Analytics não liberado:
                  value:
                    detail: Cakto Analytics não liberado para esta conta.
        '404':
          description: O produto não existe ou não é da sua conta.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnalyticsError'
              examples:
                Produto de outra conta:
                  value:
                    detail: Não encontrado.
        '429':
          description: >-
            Passou do limite de 60 consultas por minuto. Espere os segundos do
            cabeçalho `Retry-After`.
      security:
        - OAuth Token: []
components:
  schemas:
    AnalyticsProduct:
      type: object
      properties:
        product:
          type: object
          properties:
            id:
              type: string
            name:
              type: string
            image:
              type: string
              nullable: true
            price:
              type: number
              nullable: true
            status:
              type: string
            type:
              type: string
        period:
          $ref: '#/components/schemas/AnalyticsPeriod'
        updatedAt:
          type: string
          format: date-time
          description: Quando o número mais antigo do período foi calculado.
        trackingSince:
          type: string
          format: date
          nullable: true
          description: >-
            Primeiro dia com coleta no checkout. Antes dele, acesso e funil saem
            zerados.
        totals:
          $ref: '#/components/schemas/AnalyticsProductTotals'
        previousTotals:
          $ref: '#/components/schemas/AnalyticsProductTotals'
        daily:
          type: array
          items:
            type: object
            properties:
              date:
                type: string
                format: date
              pageViews:
                type: integer
              checkoutViews:
                type: integer
              uniqueVisitors:
                type: integer
              paidCount:
                type: integer
              grossAmount:
                type: number
              conversionRate:
                type: number
        breakdowns:
          type: object
          description: De onde vieram os acessos e as vendas.
          properties:
            utmSource:
              type: array
              items:
                $ref: '#/components/schemas/AnalyticsRankItem'
            utmCampaign:
              type: array
              items:
                $ref: '#/components/schemas/AnalyticsRankItem'
            affiliate:
              type: array
              description: Vendas por afiliado (nome).
              items:
                $ref: '#/components/schemas/AnalyticsRankItem'
            ownVsAffiliate:
              type: object
              properties:
                own:
                  type: object
                  properties:
                    count:
                      type: integer
                    amount:
                      type: number
                affiliate:
                  type: object
                  properties:
                    count:
                      type: integer
                    amount:
                      type: number
            country:
              type: array
              items:
                $ref: '#/components/schemas/AnalyticsRankItem'
            device:
              type: array
              items:
                $ref: '#/components/schemas/AnalyticsRankItem'
            paymentMethod:
              type: array
              items:
                type: object
                properties:
                  value:
                    type: string
                  attempts:
                    type: integer
                  paid:
                    type: integer
            refusalReason:
              type: array
              items:
                $ref: '#/components/schemas/AnalyticsRankItem'
            offers:
              type: array
              description: Order bump, upsell e downsell vendidos junto deste produto.
              items:
                type: object
                properties:
                  offerId:
                    type: string
                  productId:
                    type: string
                    nullable: true
                    description: Só quando o produto da oferta é da sua conta.
                  name:
                    type: string
                  kind:
                    type: string
                    enum:
                      - orderbump
                      - upsell
                      - downsell
                  count:
                    type: integer
                  amount:
                    type: number
                  shown:
                    type: integer
                    description: Quantas vezes o order bump apareceu no checkout.
            sources:
              type: object
              properties:
                utmSource:
                  type: array
                  items:
                    $ref: '#/components/schemas/AnalyticsVisitsAndSales'
                utmCampaign:
                  type: array
                  items:
                    $ref: '#/components/schemas/AnalyticsVisitsAndSales'
            countryRows:
              type: array
              items:
                $ref: '#/components/schemas/AnalyticsVisitsAndSales'
            deviceRows:
              type: array
              items:
                $ref: '#/components/schemas/AnalyticsVisitsAndSales'
            visitUtmSource:
              type: array
              items:
                $ref: '#/components/schemas/AnalyticsRankItem'
            pageUtmSource:
              type: array
              items:
                $ref: '#/components/schemas/AnalyticsRankItem'
            pageUtmCampaign:
              type: array
              items:
                $ref: '#/components/schemas/AnalyticsRankItem'
            visitDevice:
              type: array
              items:
                $ref: '#/components/schemas/AnalyticsRankItem'
            methodSelected:
              type: array
              items:
                $ref: '#/components/schemas/AnalyticsRankItem'
        complement:
          type: object
          nullable: true
          description: >-
            O produto vendido como order bump, upsell ou downsell de outro.
            `null` para quem só vende direto.
          additionalProperties: true
        metaAds:
          $ref: '#/components/schemas/AnalyticsMetaAds'
    AnalyticsError:
      type: object
      properties:
        detail:
          type: string
        code:
          type: string
          description: >-
            `PRO_REQUIRED` quando a rota é do Cakto Analytics Pro e a conta não
            o tem.
    UnauthenticatedError:
      type: object
      properties:
        detail:
          type: string
    AnalyticsPeriod:
      type: object
      description: >-
        O período consultado e o anterior, de mesmo tamanho, usado na
        comparação.
      properties:
        startDate:
          type: string
          format: date
        endDate:
          type: string
          format: date
        previousStartDate:
          type: string
          format: date
        previousEndDate:
          type: string
          format: date
    AnalyticsProductTotals:
      type: object
      description: Totais do produto no período, da oferta principal. Valores em reais.
      properties:
        pageViews:
          type: integer
        pageUniqueVisitors:
          type: integer
        checkoutViews:
          type: integer
        uniqueVisitors:
          type: integer
        formStarted:
          type: integer
          description: Quem começou a preencher o formulário do checkout.
        formStartedEstimated:
          type: boolean
          description: >-
            `true` quando o período não teve coleta no checkout e `formStarted`
            é estimado por quem gerou pagamento ou abandonou.
        formPrefilled:
          type: integer
        bumpShown:
          type: integer
        paymentsCreated:
          type: integer
        paidCount:
          type: integer
        grossAmount:
          type: number
        averageTicket:
          type: number
        conversionRate:
          type: number
        pixGenerated:
          type: integer
        pixPaid:
          type: integer
        pixUnpaid:
          type: integer
        pixUnpaidAmount:
          type: number
        cardAttempts:
          type: integer
        cardPaid:
          type: integer
        cardRefused:
          type: integer
        refundCount:
          type: integer
        refundAmount:
          type: number
        chargebackCount:
          type: integer
        medCount:
          type: integer
          description: Pedidos com MED (devolução do Pix) aberto.
        abandonments:
          type: integer
          description: Carrinhos abandonados.
        recoveredCount:
          type: integer
        recoveredAmount:
          type: number
        bumpCount:
          type: integer
        bumpAmount:
          type: number
        upsellCount:
          type: integer
        upsellAmount:
          type: number
        downsellCount:
          type: integer
        downsellAmount:
          type: number
        whatsapp:
          type: object
          nullable: true
          description: >-
            Recuperação por WhatsApp. `null` quando o produto não teve envio no
            período.
          properties:
            sent:
              type: integer
            read:
              type: integer
            purchased:
              type: integer
            revenue:
              type: number
              description: Vendas de quem recebeu a mensagem, em reais.
            cost:
              type: number
              description: O que você pagou pelos envios, em reais.
        funnel:
          type: object
          description: >-
            O funil nos dias com contagem de acesso ao checkout (desde `since`):
            página de vendas → checkout → formulário → pagamento → venda.
          properties:
            since:
              type: string
              format: date
              nullable: true
            pageViews:
              type: integer
            pageUniqueVisitors:
              type: integer
            pageToCheckoutRate:
              type: number
              description: >-
                Até 100%. Quem chega ao checkout por link direto não passa pela
                página.
            checkoutViewsAbovePage:
              type: boolean
            checkoutViews:
              type: integer
            formStarted:
              type: integer
            formPrefilled:
              type: integer
            formStartedEstimated:
              type: boolean
            formStartedFromPayments:
              type: boolean
            paymentsCreated:
              type: integer
            paidCount:
              type: integer
            conversionRate:
              type: number
    AnalyticsRankItem:
      type: object
      description: >-
        Uma linha de ranking. Até 10 valores, e o resto somado em `outros`.
        `(sem origem)` é o pedido sem o valor.
      properties:
        value:
          type: string
        count:
          type: integer
        amount:
          type: number
          description: Ausente nos rankings que não têm valor (aparelho, motivo de recusa).
    AnalyticsVisitsAndSales:
      type: object
      description: Acessos ao checkout e vendas aprovadas do mesmo valor na mesma linha.
      properties:
        value:
          type: string
        visits:
          type: integer
        count:
          type: integer
        amount:
          type: number
    AnalyticsMetaAds:
      type: object
      description: >-
        Indicador da conexão com o Meta Ads. Vem em toda resposta de Analytics,
        com ou sem conexão.
      properties:
        connected:
          type: boolean
          description: >-
            `true` quando a conta tem o Meta Ads conectado e o custo dos
            anúncios entra nas campanhas. Com `false`, os números de venda vêm
            inteiros e só o custo fica de fora.
        status:
          type: string
          nullable: true
          enum:
            - active
            - expired
            - null
          description: >-
            `active`: a leitura do gasto está em dia. `expired`: o Meta recusou
            o token (venceu, senha trocada, permissão removida) e é preciso
            reconectar no painel; o gasto já lido continua valendo até
            `lastSyncedAt`. `null` sem conexão.
        adAccounts:
          type: array
          description: Contas de anúncio lidas da conexão.
          items:
            $ref: '#/components/schemas/AnalyticsMetaAdAccount'
        adAccount:
          type: string
          nullable: true
          description: >-
            A conta de anúncio filtrada em `adAccount`, quando ela é da conexão.
            `null` = todas.
        lastSyncedAt:
          type: string
          format: date-time
          nullable: true
          description: >-
            Última leitura do gasto no Meta. O gasto dos três últimos dias é
            relido de hora em hora, porque o Meta ainda o ajusta.
      required:
        - connected
        - status
        - adAccounts
        - adAccount
        - lastSyncedAt
    AnalyticsMetaAdAccount:
      type: object
      properties:
        id:
          type: string
          description: Id da conta de anúncio no Meta (`act_...`).
        name:
          type: string
        currency:
          type: string
          description: Moeda da conta de anúncio (ISO 4217).
  examples:
    AnalyticsProductExample:
      summary: Produto sem o Meta conectado
      value:
        product:
          id: 4f1c2a9e-7d1b-4e34-9a7e-1c2b3d4e5f60
          name: Curso Completo
          image: null
          price: 199
          status: active
          type: unique
        period:
          startDate: '2026-11-01'
          endDate: '2026-11-30'
          previousStartDate: '2026-10-02'
          previousEndDate: '2026-10-31'
        updatedAt: '2026-11-30T20:55:00.000Z'
        trackingSince: '2026-10-20'
        totals:
          pageViews: 5210
          pageUniqueVisitors: 3900
          checkoutViews: 1840
          uniqueVisitors: 1490
          formStarted: 610
          formStartedEstimated: false
          formPrefilled: 40
          bumpShown: 1700
          paymentsCreated: 240
          paidCount: 92
          grossAmount: 18308
          averageTicket: 199
          conversionRate: 5
          pixGenerated: 150
          pixPaid: 60
          pixUnpaid: 90
          pixUnpaidAmount: 17910
          cardAttempts: 90
          cardPaid: 32
          cardRefused: 58
          refundCount: 3
          refundAmount: 597
          chargebackCount: 0
          medCount: 0
          abandonments: 310
          recoveredCount: 12
          recoveredAmount: 2388
          bumpCount: 21
          bumpAmount: 987
          upsellCount: 4
          upsellAmount: 1188
          downsellCount: 0
          downsellAmount: 0
          whatsapp: null
          funnel:
            since: '2026-11-01'
            pageViews: 5210
            pageUniqueVisitors: 3900
            pageToCheckoutRate: 35.32
            checkoutViewsAbovePage: false
            checkoutViews: 1840
            formStarted: 650
            formPrefilled: 40
            formStartedEstimated: false
            formStartedFromPayments: false
            paymentsCreated: 240
            paidCount: 92
            conversionRate: 5
        previousTotals: {}
        daily: []
        breakdowns:
          utmSource:
            - value: fb
              count: 70
              amount: 13930
            - value: (sem origem)
              count: 22
              amount: 4378
          ownVsAffiliate:
            own:
              count: 80
              amount: 15920
            affiliate:
              count: 12
              amount: 2388
          paymentMethod:
            - value: pix
              attempts: 150
              paid: 60
            - value: credit_card
              attempts: 90
              paid: 32
        complement: null
        metaAds:
          connected: false
          status: null
          adAccounts: []
          adAccount: null
          lastSyncedAt: null
    UnauthenticatedErrorExample:
      summary: Token ausente ou inválido
      description: Token ausente ou inválido
      value:
        detail: As credenciais de autenticação não foram fornecidas.
  securitySchemes:
    OAuth Token:
      type: http
      scheme: bearer
      in: header
      name: Authorization
      description: >-
        Token de autenticação do tipo `Bearer {access_token}`, onde
        `{access_token}` é o token obtido no fluxo de
        [autenticação](/authentication).

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.