> For the complete documentation index, see [llms.txt](https://help.recart.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.recart.com/developers/public-api/optin-tool/statistics-view-of-an-opt-in-tool.md).

# Statistics view of an opt-in tool

One statistics view of a popup-type opt-in tool. `name` picks the view; `all` returns every section in one response. When the date range is omitted it defaults to the last 7 days.

Statistics fields are never null: buckets without activity and empty ranges return 0 counts and 0 rates — zero and "no data" are deliberately not distinguished, matching the dashboard. The only fields that can be absent are the channel-gated email/SMS ones, which are omitted when the tool does not collect that channel.

```json
{"openapi":"3.1.0","info":{"title":"Recart API","version":"2023-12"},"tags":[{"name":"OptinTool","description":"Opt-in tools"}],"servers":[{"url":"https://api.recart.com/app-integrations/2023-12","description":"Production"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-Recart-API-Key","description":"It can be obtained in Recart account after contacting Support"}},"schemas":{"OptinToolViews":{"type":["object"],"required":["type","attributes"],"properties":{"type":{"type":"string","enum":["optin-tool-views"]},"attributes":{"type":"object","description":"The requested view's data under its name — exactly one key for a\nsingle view, all seven for name=all. History and breakdown values\nare arrays (one element per bucket / country / segment).\n","minProperties":1,"properties":{"optin-summary":{"description":"Opt-in performance totals for the range","$ref":"#/components/schemas/OptinToolOptinSummaryData"},"optin-history":{"type":"array","description":"Opt-in performance per bucket; one bucket per targetResolution unit, gaps zero-filled","items":{"$ref":"#/components/schemas/OptinToolOptinHistoryBucket"}},"revenue-summary":{"description":"Revenue attributed to the tool, totals for the range","$ref":"#/components/schemas/RevenueMetrics"},"revenue-history":{"type":"array","description":"Attributed revenue per bucket; one bucket per targetResolution unit, gaps zero-filled","items":{"$ref":"#/components/schemas/OptinToolRevenueHistoryBucket"}},"revenue-by-optin-segments":{"type":"array","description":"Attributed revenue split by opt-in segment; one element per segment plus a total row","items":{"$ref":"#/components/schemas/OptinToolRevenueByOptinSegmentsItem"}},"revenue-by-countries":{"type":"array","description":"Impressions and attributed revenue per country, sorted desc by associatedRevenue; UNKNOWN_COUNTRY included","items":{"$ref":"#/components/schemas/OptinToolRevenueByCountriesItem"}},"subscriptions-history":{"type":"array","description":"New SMS subscribers collected by the tool per bucket; one bucket per targetResolution unit, gaps zero-filled","items":{"$ref":"#/components/schemas/OptinToolSubscriptionsHistoryBucket"}}}}}},"OptinToolOptinSummaryData":{"type":"object","description":"Opt-in performance totals for the range. Counts are unique sessions.\nEmail/SMS fields appear only when the tool collects that channel.\nFields are never null: a range without data returns 0 counts and\n0 rates.\n","required":["impression","teaserConfirm","teaserConfirmRate","teaserDecline"],"properties":{"impression":{"type":"integer","description":"Unique sessions in which the popup was displayed"},"teaserConfirm":{"type":"integer","description":"Unique sessions that clicked the teaser and opened the popup"},"teaserConfirmRate":{"type":"number","description":"teaserConfirm / impression"},"teaserDecline":{"type":"integer","description":"Unique sessions that dismissed the teaser"},"emailOptin":{"type":"integer","description":"Unique sessions that submitted an email address on the popup"},"emailOptinRate":{"type":"number","description":"emailOptin / impression"},"phoneNumberSubmitted":{"type":"integer","description":"Unique sessions that submitted a phone number on the popup"},"phoneNumberSubmittedRate":{"type":"number","description":"phoneNumberSubmitted / impression"},"smsOptin":{"type":"integer","description":"Unique sessions that completed the SMS opt-in"},"smsOptinRate":{"type":"number","description":"smsOptin / impression"}}},"OptinToolOptinHistoryBucket":{"type":"object","required":["timestamp","impression"],"properties":{"timestamp":{"type":"string","format":"date","description":"Start of the bucket, in UTC (weeks start on Monday)"},"impression":{"type":"integer","description":"Unique sessions in which the popup was displayed within the bucket"},"emailOptin":{"type":"integer","description":"Unique sessions that submitted an email address within the bucket"},"emailOptinRate":{"type":"number","description":"emailOptin / impression within the bucket"},"smsOptin":{"type":"integer","description":"Unique sessions that completed the SMS opt-in within the bucket"},"smsOptinRate":{"type":"number","description":"smsOptin / impression within the bucket"}}},"RevenueMetrics":{"type":"object","description":"Revenue attributed to the opt-in tool: orders placed within 7 days\nof an interaction with the tool in the same session. Amounts are in\nUSD, rounded to 2 decimal places. Fields are never null: a range\nwithout attributed orders returns 0 amounts, and rates are 0 when\nthe denominator is 0.\n","required":["associatedRevenue","orders","averageOrderValue","revenuePerVisitor","orderConversionRate"],"properties":{"associatedRevenue":{"type":"number","description":"Total value of the orders attributed to the opt-in tool, in USD"},"orders":{"type":"integer","description":"Number of orders attributed to the opt-in tool"},"averageOrderValue":{"type":"number","description":"associatedRevenue / orders, in USD"},"revenuePerVisitor":{"type":"number","description":"associatedRevenue / impressions, in USD"},"orderConversionRate":{"type":"number","description":"orders / impressions"}}},"OptinToolRevenueHistoryBucket":{"allOf":[{"type":"object","required":["timestamp"],"properties":{"timestamp":{"type":"string","format":"date","description":"Start of the bucket, in UTC (weeks start on Monday)"}}},{"$ref":"#/components/schemas/RevenueMetrics"}]},"OptinToolRevenueByOptinSegmentsItem":{"allOf":[{"type":"object","required":["optinSegmentType","optinSegmentCount"],"properties":{"optinSegmentType":{"type":"string","description":"The deepest opt-in stage the sessions in this row reached\n(noOptin / emailOptin / smsOptin / emailAndSMSOptin); the\ntotal row sums the whole funnel\n","enum":["noOptin","emailOptin","smsOptin","emailAndSMSOptin","total"]},"optinSegmentCount":{"type":"integer","description":"Unique sessions whose deepest opt-in stage is this segment"}}},{"$ref":"#/components/schemas/RevenueMetrics"}]},"OptinToolRevenueByCountriesItem":{"allOf":[{"type":"object","required":["countryCode","impressionCount"],"properties":{"countryCode":{"type":"string","description":"ISO 3166-1 alpha-2 country code of the visitors;\n"},"impressionCount":{"type":"integer","description":"Unique sessions in which the popup was displayed in this country"}}},{"$ref":"#/components/schemas/RevenueMetrics"}]},"OptinToolSubscriptionsHistoryBucket":{"type":"object","required":["timestamp","subscriptions"],"properties":{"timestamp":{"type":"string","format":"date","description":"Start of the bucket, in UTC (weeks start on Monday)"},"subscriptions":{"type":"integer","description":"New SMS subscribers the opt-in tool collected within the bucket"}}},"HttpErrorBody":{"type":"object","required":["errors"],"properties":{"errors":{"type":"array","items":{"type":"object","required":["id","code","title","detail"],"properties":{"id":{"type":"string"},"code":{"type":"string"},"title":{"type":"string"},"detail":{"type":"string"}}}}}}},"responses":{"HttpError":{"description":"HTTP Error response","content":{"application/vnd.api+json":{"schema":{"$ref":"#/components/schemas/HttpErrorBody"}}}}}},"paths":{"/optin-tools/{id}/views/{name}":{"get":{"summary":"Statistics view of an opt-in tool","tags":["OptinTool"],"operationId":"getOptinToolView","description":"One statistics view of a popup-type opt-in tool. `name` picks the view; `all`\nreturns every section in one response. When the date range is\nomitted it defaults to the last 7 days.\n\nStatistics fields are never null: buckets without activity and empty\nranges return 0 counts and 0 rates — zero and \"no data\" are\ndeliberately not distinguished, matching the dashboard. The only\nfields that can be absent are the channel-gated email/SMS ones,\nwhich are omitted when the tool does not collect that channel.\n","parameters":[{"name":"id","in":"path","required":true,"description":"ID of the opt-in tool","schema":{"type":"string"}},{"name":"name","in":"path","required":true,"description":"The view to return","schema":{"type":"string","enum":["optin-summary","optin-history","revenue-summary","revenue-history","revenue-by-optin-segments","revenue-by-countries","subscriptions-history","all"]}},{"name":"dateFrom","in":"query","description":"First day of the range, inclusive (YYYY-MM-DD, UTC).\nDefaults to 7 days before `dateTo`.\n","schema":{"type":"string","format":"date"}},{"name":"dateTo","in":"query","description":"Last day of the range, inclusive — `dateTo=2026-08-10` includes\nthe whole of 2026-08-10 (UTC). Defaults to today.\n","schema":{"type":"string","format":"date"}},{"name":"targetResolution","in":"query","description":"Bucket size of the time series — history views and `all` only. Buckets are UTC; weeks start on Monday.","schema":{"type":"string","enum":["day","week","month","year"],"default":"day"}}],"responses":{"200":{"description":"Ok","content":{"application/vnd.api+json":{"schema":{"type":"object","properties":{"data":{"description":"Always one resource of type optin-tool-views. attributes\nholds the requested view's data under its name — one key\nfor a single view, all seven for name=all.\n","$ref":"#/components/schemas/OptinToolViews"}}}}}},"4XX":{"$ref":"#/components/responses/HttpError"},"5XX":{"$ref":"#/components/responses/HttpError"}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.recart.com/developers/public-api/optin-tool/statistics-view-of-an-opt-in-tool.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
