# Data Studio

### 📊 What you can do

Connect Zigpoll to [Data Studio](https://lookerstudio.google.com) and visualize your survey data alongside the rest of your reporting stack. Common use cases:

* Time-series charts of responses, completes, and presentations
* NPS / CSAT averages and distributions, broken down by survey or question
* Cross-survey engagement comparisons
* Period-over-period trend reporting (this month vs. last month)
* Embeddable, shareable dashboards for execs, CS, or marketing

### 🚀 How to install

1. **Get your Zigpoll API key.** Open your Zigpoll dashboard → **Integrations** → **API Keys** → **Create Api Key**. Copy the key. (Full instructions: [API Key](/integrations/api-key.md).)
2. **Find your accountId.** Open the **Settings** page in your Zigpoll dashboard — your accountId is shown there.
3. **Add the connector to Data Studio.** Open this URL in a browser logged into the Google account you want to own the data source:

   ```
   https://lookerstudio.google.com/datasources/create?connectorId=<DEPLOYMENT_ID>
   ```

   Data Studio will prompt you to authorize the connector, then ask for your Zigpoll API key.
4. **Choose a dataset.** Pick one of:
   * **Polls overview** — one row per survey, with lifetime counts (responses, completes, presentations, etc.).
   * **Daily aggregates** — one row per day × survey × question × answer, perfect for time-series charts.
   * **NPS aggregates** — one row per day × NPS-style question, with promoter / passive / detractor counts and a daily NPS score.
5. **Enter your accountId** in the connector config and (optionally) a specific `pollId` if you only want to chart a single survey.
6. Click **Connect** and start building reports.

### 📐 Datasets

#### Polls overview

One row per poll. Useful for top-line summaries and survey leaderboards.

| Field                                                                                                | Type         | Notes           |
| ---------------------------------------------------------------------------------------------------- | ------------ | --------------- |
| `pollId`, `pollTitle`, `pollSlug`                                                                    | Text         |                 |
| `createdAt`                                                                                          | Date/time    |                 |
| `pollType`, `status`                                                                                 | Text         |                 |
| `responseCount`, `voteCount`, `completeCount`, `presentationCount`, `emailCount`, `participantCount` | Number (sum) | Lifetime totals |

#### Daily aggregates

One row per day × poll × slide × answer handle. Ideal for time-series and answer-distribution charts.

| Field                                | Type         | Notes                                                                              |
| ------------------------------------ | ------------ | ---------------------------------------------------------------------------------- |
| `day`                                | Date         | Bucketed by UTC by default                                                         |
| `pollId`, `pollTitle`                | Text         |                                                                                    |
| `slideId`, `slideTitle`, `slideType` | Text         |                                                                                    |
| `answerHandle`, `answerTitle`        | Text         |                                                                                    |
| `valueType`                          | Text         | e.g. `response`, `form-response`                                                   |
| `count`                              | Number (sum) | Number of responses for this answer on this day                                    |
| `rankSum`                            | Number (sum) | Sum of ranks (use `rankSum / count` for average rank, e.g. NPS or rating averages) |

#### NPS aggregates

One row per day × NPS-style question (any slide of type `range`, `star-rating`, or `satisfaction`). Buckets the answer handles into detractor / passive / promoter using the same rules the in-app NPS chart uses, so the dashboard NPS matches what you see inside Zigpoll.

| Field                                                           | Type         | Notes                                                                                                                                                                                                                                                                                                 |
| --------------------------------------------------------------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `day`                                                           | Date         |                                                                                                                                                                                                                                                                                                       |
| `pollId`, `pollTitle`                                           | Text         |                                                                                                                                                                                                                                                                                                       |
| `slideId`, `slideTitle`, `slideType`                            | Text         |                                                                                                                                                                                                                                                                                                       |
| `detractorCount`, `passiveCount`, `promoterCount`, `totalCount` | Number (sum) | Per-day counts in each bucket                                                                                                                                                                                                                                                                         |
| `npsScore`                                                      | Number (avg) | Per-day NPS score, `(promoters − detractors) / total × 100`. Aggregation is set to AVG so it works at day granularity. **For weekly / monthly rollups create a Data Studio calculated field:** `(SUM(promoterCount) − SUM(detractorCount)) / SUM(totalCount) * 100` to get a properly weighted score. |

Bucketing rules: handles are bucketed by their position in the answer list. With ≥ 6 answers (e.g. an 11-point 0–10 scale): the bottom 70% are detractors, the next 20% are passives, the top 10% are promoters. With ≤ 5 answers (e.g. a 1–5 satisfaction scale): the bottom 50% are detractors, the next 30% are passives, the top 20% are promoters.

### 📏 Limits

* The connector clamps date ranges to a maximum of **90 days** per query. Use Data Studio's date control to navigate further back; the connector will paginate within each window.
* Pagination caps: 10,000 rows per page for **Polls overview**, 100,000 rows per page for **Daily aggregates**, with up to 50 pages per request.
* The connector caches responses for 60 seconds (`Cache-Control` header) to keep large dashboards snappy.

### 🛠️ Troubleshooting

* **"This API key doesn't have access to that account"** — Confirm the accountId you entered matches the account the API key was generated under, and that your account has API access enabled (Advanced plan or higher).
* **"Zigpoll API key was rejected"** — The key was revoked or removed. Generate a fresh key on the **API Keys** tab and reconnect the data source.
* **Data Studio shows "no data"** — Try widening the date range, removing any `pollId` filter, or confirming the chosen dataset matches the chart you're building.

### 🔄 Refreshing data

Data Studio caches connector data per the `Cache-Control` header (60s). To force a refresh inside a report, click **Resource → Manage data freshness** or use the **Refresh data** option on a chart.


---

# Agent Instructions: 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:

```
GET https://docs.zigpoll.com/integrations/data-studio.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
