> For the complete documentation index, see [llms.txt](https://docs.zigpoll.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zigpoll.com/questions/question-logic.md).

# Question Logic

Perform logic jumps or other actions using question logic.

Question logic is a powerful tool you can use to create unique experiences depending on how a respondent answers your survey questions.

To create question logic click the *+Add Logic* button on the Question edit page.

<figure><img src="https://1643988190-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LZpanNFqg3aCUZgXh3X%2Fuploads%2FYpgE21sgsiifi2YEJeqj%2Fimage.png?alt=media&amp;token=4b2b14e8-fab9-47ad-8d6c-149c2bad10b7" alt=""><figcaption></figcaption></figure>

#### Conditions

To get started with logic you need to first chose a **condition**. A condition is a rule that needs to be met in order for the corresponding **action** to take place.

A condition is based on the response to your particular question. For example a condition can be if a response is > or < a certain value, or a condition can be if a response equals a certain pre-defined value.

You can stack conditions on top of each other to create complex logic within your survey. To do this, you will want to hit "Add condition".

{% hint style="info" %}
For **Matrix** questions, a condition can target a single question (row) — for example "if the *Delivery* row is rated Poor." Pick the question from the row dropdown when building the condition, or leave it on **any row** to match against every option selected across the whole matrix.
{% endhint %}

<figure><img src="https://1643988190-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LZpanNFqg3aCUZgXh3X%2Fuploads%2FIXfugl3S9EewGdzfPjWp%2Fimage.png?alt=media&amp;token=3cd00b4c-3abc-4350-8b32-9cec8cd65e4e" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1643988190-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LZpanNFqg3aCUZgXh3X%2Fuploads%2FZJaupckyfHw3ZvDnjKfz%2Fimage.png?alt=media&amp;token=cda83c87-22f1-4c23-940d-b2b8c287ef7f" alt=""><figcaption></figcaption></figure>

When a condition is met, the **action** you define will then take place. An action can be something within your survey like **skip** or **end survey** as well as an external action like **adding a metafield to Shopify** or **adding a customer tag**.

#### Actions for all users

A list of actions to chose from can be found below:

* **Continue to the next question -** move to next question
* **End Survey**
* **Skip to -** direct to another question
* **Redirect To -** Send to a specific URL or web address
* **Run code -** Trigger a webhook or execute a script
* **Send Email -** Send an email to the respondent or yourself
* **Set / Unset metadata -** Store a value on the response (or remove one)
* **Increment / Decrement / Multiply / Divide metadata -** Adjust a numeric metadata value. A key that has never been set starts at 0.

#### Metadata conditions

Besides answers, a condition can read **metadata** — either values you passed in from your site, or values stored by the metadata actions above. Pick **metadata** as the condition's source and enter the key name.

A metadata condition can compare against a fixed value (`metadata.score > 10`) **or against another metadata key**, with an optional offset. Choose **metadata** in the value picker and enter the other key:

* `metadata.a > metadata.b` — a is strictly larger than b
* `metadata.a > metadata.b + 1` — a leads b by at least 2
* `metadata.a >= metadata.b + -1` and `metadata.a <= metadata.b + 1` — a and b are tied or within one point

A key that has never been set counts as 0 in comparisons.

{% hint style="info" %}
**Scoring quizzes — "which option was picked most?"**

Give each answer style its own counter. On every question, add logic like *when this question is A → increment metadata `a` by 1* (and likewise `b`, `c`, `d`). Then add one result question per outcome, each using **Show or hide this question** with metadata conditions, for example:

* Show "Classic" when `metadata.a > metadata.b + 1` **and** `metadata.a > metadata.c + 1` **and** `metadata.a > metadata.d + 1`
* Show a blended "Romantic & Modern" result when `metadata.b >= metadata.c + -1` **and** `metadata.b <= metadata.c + 1`, and both b and c beat a and d.

Counters update before the next question's visibility is evaluated, so result questions placed at the end of the survey see the final totals.
{% endhint %}

#### Integration actions

If you have integrations enabled, additional actions will appear in the dropdown. These actions trigger using the full survey response data, not just the current question.

**Slack** — Send a notification to a selected Slack channel.

**Jira** — Create a new issue in a selected Jira project.

**ClickUp** — Create a new task in a selected ClickUp list.

**HubSpot** — Create a new deal in a selected HubSpot pipeline.

**Zendesk** — Create a new support ticket.

**Notion** — Add a new row to a selected Notion database.

**Klaviyo** — Subscribe the respondent to a selected Klaviyo list.

**Google Sheets** — Write a row of response data to a Google Sheet. Zigpoll creates the sheet automatically when you save, with headers based on your survey questions. You will be emailed a link to the sheet when the first response comes in.

**Mailchimp** — Subscribe the respondent to a selected Mailchimp audience.

**Drip** — Subscribe the respondent to a selected Drip campaign.

**Omnisend** — Add the respondent as a contact in Omnisend.

**Marketo** — Create or update a lead and add them to a static list in Adobe Marketo.

{% hint style="info" %}
Integration actions only appear when the corresponding integration is connected in your [Integration Settings](/integrations.md). Actions that require an email (Klaviyo, Mailchimp, Drip, Omnisend) will only fire if the respondent has provided an email address.
{% endhint %}

#### Additional actions for Shopify stores

If you installed Zigpoll on a Shopify store, this comes with additional actions you can trigger:

* **Add Customer Tag ->** \*note that this will require a valid shopify\_customer\_id or email to be included as metadata.
* **Add Order Tag ->** \*note that this will require a valid shopify\_order\_id to be included as metadata.
* **Add Customer Metafield ->** \*note if you are mapping this to a pre-defined metafield it needs to be a multi\_line\_text\_field type.
* **Add Order Metafield ->** \*note if you are mapping this to a pre-defined metafield it needs to be a multi\_line\_text\_field type.
* **Generate Reward ->** generate a discount code or add free shipping


---

# 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://docs.zigpoll.com/questions/question-logic.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.
