# Smart Data Gathering

> Collect contact details and other data during a conversation: what to collect, when and how the AI Agent asks for it, and where the captured details go.

**Smart Data Gathering** allows your AI Agent to collect user information seamlessly during conversations. It engages with users naturally, asking relevant questions to gather details like name, email, phone number, or any other information you require. This data can then be sent to your CRM or other systems, enabling you to follow up effectively and convert potential leads into customers.

## Optional example checks

- [Preview metadata keys][public-lab-metadata-keys-webmcp]. Check how supplied field names become variable keys, including duplicate names and reserved-key errors. This does not inspect values or account-specific permissions.

- [Check Action run conditions][public-lab-action-conditions-webmcp]. Evaluate conditions against supplied sample metadata without running an Action.

In a compatible browser, these checks are also available as site tools. The links open the standard forms.

## How it works

Smart Data Gathering operates within the existing conversation flow, ensuring that the interaction feels natural and non-intrusive.

When a user interacts with your AI Agent, it:

1. Detects opportunities to collect information, such as when a user expresses interest in your services or products.
2. Asks specific questions tailored to your needs, like:
   - "Can I have your name to better assist you?"
   - "What's the best email to contact you on?"
3. Gathers and stores the responses, making them available for review or integration with your CRM system.

The feature is designed to minimize friction while maximizing the quality of leads captured.

## Setting it up

## Enable Smart Data Gathering

- Navigate to the **Actions & MCPs** tab
- Find **Smart Data Gathering** card
- Toggle the feature on

![Enabling Smart Lead Generation](https://quickchat.ai/docs/_astro/leadgen_enable.bLlVVOj-.webp)

## Data to Collect

Configure up to 10 data points. Each row contains:

- **Data point:** A short name for the captured value, such as `Email`, `Name`, or `Budget`.
- **Question to ask:** The question you want the AI Agent to ask, written the way you would say it, such as `What is your job title?`.
- **Format or example values:** Guidance that helps the AI Agent recognize a useful answer, such as `0-10 | 10-50 | 50-100 | 100+`.
- **Enabled:** Whether the AI Agent should collect this data point.

New actions start with `Email` and `Name` enabled. `Phone number`, `Budget` and `Company size` are included as disabled examples. Enable any of them, reword their questions, or add your own rows.

![Selecting data fields to collect](https://quickchat.ai/docs/_astro/leadgen_data2collect.DStjvnzH.webp)

## Why You're Collecting It

**Reason for collecting information** tells the AI Agent what the details are for, and who is worth asking. The text goes into the conversation instructions, so the AI Agent can give the reason when it asks, and leave alone the visitors it does not apply to.

One or two sentences, up to 500 characters. For example:

- `To send you a personalised quote and follow up on your order.`
- `So our team can follow up with setup help. Only ask visitors evaluating us for a real business or project: they describe their own site or use case, ask about pricing, or want a demo.`

The second one also sets a bar. If you only want qualified leads, say here who counts as one, rather than collecting an address from everybody.

## When to Ask for Data

Define when the AI Agent should ask for contact details.

- After exchanging a few messages
- Immediately after the user expresses interest

New actions start with **After exchanging a few messages** selected, which also keeps the AI Agent from asking on a greeting or an opening message that says nothing about the visitor. **Immediately after the user expresses interest** asks at the first opportunity, so pick it only when every visitor is worth asking.

![Configuring when to collect data](https://quickchat.ai/docs/_astro/leadgen_when_to_ask.BmutbUho.webp)

## How to Ask for Data

Customize how the AI Agent asks for information.

- **Subtle:** Integrates questions naturally into the conversation
- **Direct:** Explicitly requests the information in a straightforward manner

![Configuring data collection approach](https://quickchat.ai/docs/_astro/leadgen_how_to_ask.Bx5tFIiN.webp)

## What the AI Agent Will Not Do

Some rules hold for every action, whatever you configure:

- **It answers first.** The question comes after the answer, never instead of it, and an answer is never made conditional on getting the details.
- **It does not ask for something it already has.** If your site or app already passes the visitor's name, email or phone number to the AI Agent, it will not ask for them again.
- **It stops when someone declines.** A visitor who says no is not asked again for the rest of the conversation, for any of your data points. If they offer the detail later anyway, it is still captured.
- **It does not ask at a bad moment.** Never in the same reply as a refusal, and never when the conversation is off-topic or abusive.

Smart Lead Generation enables your AI Agent to collect user contact details efficiently while ensuring compliance and providing a seamless conversational experience.

## Getting an email for each new lead

Under **Where to send data**, **Email new leads** is on by default. The first time the AI Agent captures a visitor's email or phone number in a conversation, every admin of this AI Agent gets an email with the captured details, the latest messages and a link to the conversation.

- A name alone isn't enough. When the name comes first, the email waits for the email address or phone number.
- No email is sent for a visitor whose email or phone number your site, app or channel already passed to the AI Agent.
- Preview and Simulation conversations never send one.

Turn **Email new leads** off to stop these emails for this AI Agent.

## Using the details in Actions

Every data point is also available to your [API Actions](/docs/ai-agent/actions) as a variable, such as `{{metadata_budget}}`, with contact details under `{{metadata_visitor_email}}`, `{{metadata_visitor_name}}` and `{{metadata_visitor_phone_number}}`. When the AI Agent captures an email, name or phone number the conversation didn't have yet, it also sets `lead_captured` to `true`.

To send each new lead to your CRM or a Slack channel, set an API Action to **When metadata matches**, add the **Run when** condition `lead_captured is true`, and put the variables in its request body. See [AI Action Variables](/docs/ai-agent/variables#custom-metadata-keys) for how names become variables and which ones are reserved. Action input mappings in [Save to memory](/docs/ai-agent/actions#save-to-memory) set `lead_captured` too. If an Action with such a mapping already sends the lead to your CRM, don't also send it from a `lead_captured` trigger, or it arrives twice.

## Exporting the captured contact details

Follow these steps to export the details captured by your AI Agent:

1. Go to the **Inbox**.
2. Click the export icon to access export options.
3. Select **Export Gathered Data** from the dropdown menu.
4. Set **Start date** and **End date** for the data you want to export.
5. Choose **CSV (.csv)** or **Excel (.xlsx)**.
6. Leave **Email download link** enabled to receive a link at your account email when the file is ready, or turn it off if you only want the browser download.
7. Click **Download** to start preparing the file in the background.

Keep Quickchat open for the download to start automatically when the file is ready. If your browser blocks it, click **Download** in the completion notification. With email delivery enabled, you can leave the page and use the emailed link, which is valid for 24 hours.

Only one gathered-data export can be prepared at a time for each AI Agent. Wait for it to finish before starting another with different settings. A conversation export can run alongside it.

XLSX exports support up to 100,000 conversations per file. Choose CSV for larger exports or when the file has more columns than Excel supports. See [Inbox export options](/docs/conversations/inbox#export-options) for the available filters and export contents.

---

[public-lab-metadata-keys-webmcp]: https://app.quickchat.ai/v1/api_core/public-question/quickchat/tools/metadata-keys/lab/webmcp/?placement=docs-smart-data-metadata-keys-webmcp-v1

[public-lab-action-conditions-webmcp]: https://app.quickchat.ai/v1/api_core/public-question/quickchat/tools/action-conditions/lab/webmcp/?placement=docs-smart-data-action-conditions-webmcp-v1
