> ## Documentation Index
> Fetch the complete documentation index at: https://help.treble.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# fact_ad_sessions

> Conversations that started from a Click-to-WhatsApp ad, with the ad's creative details.

# fact\_ad\_sessions

Each row is one conversation that started when a user clicked a **Click-to-WhatsApp ad** (Facebook/Instagram), together with the creative that brought them: headline, body, media, and the ad's source id. Join with `fact_treble_sessions` through `session_id` for outcome analysis. This dataset was not available in the previous warehouse.

## What questions does it answer?

* Which ads generate the most WhatsApp conversations?
* Which creatives (headline/body/media) convert best once the conversation starts?
* What is the funnel from ad click to goal (join with `fact_target_events`)?

## Columns

| Column          | Type       | Description                                                             |
| --------------- | ---------- | ----------------------------------------------------------------------- |
| `session_id`    | Int64      | The conversation the ad started (join `fact_treble_sessions`)           |
| `company_id`    | Int32      | Your company (filtered automatically)                                   |
| `created_at`    | DateTime64 | When the conversation started                                           |
| `headline`      | String     | Ad headline                                                             |
| `body`          | String     | Ad body text                                                            |
| `source_type`   | String     | `ad` or `post`; occasionally empty when Meta doesn't send the field     |
| `source_id`     | String     | Meta's id of the ad/post — key for joining with your Meta Ads reporting |
| `source_url`    | String     | URL of the ad/post                                                      |
| `media_type`    | String     | `image` or `video`; occasionally empty                                  |
| `image_url`     | String     | Creative image URL, when media is an image                              |
| `video_url`     | String     | Creative video URL, when media is a video                               |
| `thumbnail_url` | String     | Video thumbnail URL                                                     |
| `treble_image`  | String     | Copy of the creative stored by Treble                                   |
| `synced_at`     | DateTime64 | When this row was last written/corrected                                |

## Example queries

### Conversations per ad, last 30 days

```sql theme={null}
SELECT source_id, any(headline) AS headline, count() AS conversations
FROM fact_ad_sessions
WHERE created_at >= today() - 30
GROUP BY source_id
ORDER BY conversations DESC
```

### From ad to conversion

```sql theme={null}
SELECT
    a.source_id,
    any(a.headline)                 AS headline,
    uniqExact(a.session_id)         AS conversations,
    uniqExact(t.session_id)         AS converted
FROM fact_ad_sessions AS a
LEFT JOIN fact_target_events AS t
    ON t.company_id = a.company_id AND t.session_id = a.session_id
WHERE a.created_at >= today() - 30
GROUP BY a.source_id
ORDER BY conversations DESC
```
