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

# Explorer

> Build custom analytics queries and reports using the Explorer in Aftersell.

The Explorer lets you build custom analytics queries using a flexible query builder (AftersellQL). You can select metrics, group results by dimensions, apply filters, and visualize data in charts or tables. Saved queries can be added to reports as widgets for ongoing monitoring.

<Tip>
  You build queries visually with menus — no syntax required. If you prefer to type queries directly, the Explorer also exposes the underlying AftersellQL text. See [Writing AQL queries](#writing-aql-queries) below for the syntax reference.
</Tip>

***

## Available metrics

These are the metrics you can pick in the Explorer, grouped the same way the metric picker groups them.

### Revenue & profit

| Metric                       | Description                                                                           |
| ---------------------------- | ------------------------------------------------------------------------------------- |
| **Revenue**                  | Upsell revenue in your store's native currency.                                       |
| **Revenue (USD)**            | Upsell revenue normalized to USD for cross-currency comparisons.                      |
| **Revenue Per Visit**        | Upsell revenue per impression session. Cannot be broken down by product or placement. |
| **Avg. Conversion Value**    | Revenue per accepted offer. Also referred to as Average Upsell Value.                 |
| **Upsell Revenue Per Order** | Upsell revenue (USD) divided by total orders. Store-level only.                       |

### Conversions

| Metric           | Description                                                              |
| ---------------- | ------------------------------------------------------------------------ |
| **Conversions**  | Unique sessions that accepted an offer.                                  |
| **Accept Rate**  | Conversions divided by impressions.                                      |
| **Units Sold**   | Total units sold through upsell offers.                                  |
| **Decline Rate** | Percent of post-purchase offers explicitly declined. Post-purchase only. |

### Engagement

| Metric          | Description                                          |
| --------------- | ---------------------------------------------------- |
| **Impressions** | Unique sessions that saw an offer.                   |
| **Show Rate**   | Percent of decisions that resulted in an impression. |

### Store performance

| Metric                        | Description                                                                                                          |
| ----------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| **Total Store Revenue**       | Total Shopify-paid order revenue. Store-level only — cannot be broken down by surface, funnel, placement, or device. |
| **Orders**                    | Total Shopify-paid orders. Store-level only.                                                                         |
| **Average Total Order Value** | Store revenue divided by orders. Store-level average order value.                                                    |

### Rokt network

| Metric                         | Description                                                                                          |
| ------------------------------ | ---------------------------------------------------------------------------------------------------- |
| **Rokt Revenue**               | Rokt-network revenue attributed to your store.                                                       |
| **Rokt Transactions**          | Rokt-network transaction count for your store.                                                       |
| **Rokt Revenue / Transaction** | Rokt revenue divided by transactions per time bucket.                                                |
| **Rokt Impressions**           | Total Rokt-network impressions across your store's placements. Distinct from upsell **Impressions**. |
| **Rokt Referrals**             | Rokt-network referrals — positive engagements that sent the shopper to a Rokt partner.               |

***

## Dimensions

Dimensions let you break down metrics by a specific attribute. Not all dimensions are compatible with every metric.

<Note>
  Some dimension and metric combinations are incompatible. For example, **Decline rate** and **Show rate** cannot be broken down by **Currency**. The Explorer automatically prevents incompatible combinations.
</Note>

### Available dimensions

| Dimension     | Description                                                                                                                                        |
| ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Date**      | Groups results by day, week, or month.                                                                                                             |
| **Surface**   | The upsell surface (for example, post-purchase, checkout, product page).                                                                           |
| **Funnel**    | The specific funnel the offer belongs to.                                                                                                          |
| **Product**   | The upselled product.                                                                                                                              |
| **Placement** | The placement within a funnel.                                                                                                                     |
| **Device**    | The device type (desktop or mobile).                                                                                                               |
| **Scope**     | The decision scope (Flow, Experience, Placement, or ItemSlot).                                                                                     |
| **Currency**  | The ISO currency code (for example, USD, EUR, GBP). Useful for multi-currency stores. Compatible with store-level metrics and most upsell metrics. |

### Unavailable dimensions

The following dimensions are a work in progress. They appear in the picker but are not yet available as a breakdown. Instead, they show as 'Not compatible' for every metric. **This document will be updated when these dimensions are fully implemented.**

| Dimension         | Description                                                    |
| ----------------- | -------------------------------------------------------------- |
| **Flow type**     | The type of upsell flow.                                       |
| **Experiment**    | The A/B test or experiment variant.                            |
| **Outcome**       | The decision outcome (for example, eligible, out of stock).    |
| **Reason code**   | The reason for a decision outcome.                             |
| **Scope**         | The decision scope (Flow, Experience, Placement, or ItemSlot). |
| **Response type** | The offer response (Accepted, Declined, or Timeout).           |

***

## Writing AQL queries

Every query you build in the Explorer is an **AftersellQL (AQL)** statement. Most of the time you build queries visually — picking metrics, dimensions, filters, and a date range from menus — and never need to write AQL by hand.

For power users, the Explorer also exposes the underlying query as editable text. This section is the reference for that text form: what the clauses mean, what values they accept, and a few ready-to-use examples.

### How an AQL statement reads

An AQL statement is a single question made of clauses. Only `SELECT` and a time range (`SINCE`) are required; everything else is optional. When you include optional clauses, they must appear in the order shown below.

```text theme={"theme":{"light":"snazzy-light","dark":"github-dark"}}
SELECT    <metrics>                    -- what to measure (required)
WHERE     <filters>                    -- narrow the data
GROUP BY  <dimensions>                 -- break the numbers down
SINCE     <time range>                 -- the period to cover (required)
GRAIN     <time grain>                 -- bucket size for time series
COMPARE   <comparison>                 -- compare against another period
CHART     <visualization>              -- how to display the result
TIMEZONE  "<timezone>"                 -- timezone for date buckets
ORDER BY  <field> <direction>          -- sort the results
LIMIT     <number>                     -- cap the number of rows
```

A minimal example — daily upsell revenue and accept rate for the last 30 days:

```aql theme={"theme":{"light":"snazzy-light","dark":"github-dark"}}
SELECT revenue, accept_rate
GROUP BY date
SINCE last_30d
GRAIN day
```

<Note>
  Keywords are not case-sensitive (`SELECT` and `select` both work) and statements do not end with a semicolon. String values are wrapped in double quotes; numbers and lists are not.
</Note>

### Picking what to measure and how to slice it

* **`SELECT`** lists the metrics to measure, separated by commas — for example `SELECT revenue, impressions, accept_rate`.
* **`GROUP BY`** breaks those metrics down by one or more dimensions, such as `date`, `device`, `surface`, or `funnel`. Without `GROUP BY`, you get a single total for the whole period.

For the full list of available metrics and dimensions — and which combinations are allowed — see [Available metrics](#available-metrics) and [Available dimensions](#available-dimensions) above. The Explorer prevents incompatible metric and dimension combinations automatically.

#### Filtering with `WHERE`

`WHERE` narrows the data before it is measured. Combine conditions with `AND`.

```aql theme={"theme":{"light":"snazzy-light","dark":"github-dark"}}
SELECT revenue, impressions, accept_rate, rpv
WHERE device = "mobile"
GROUP BY date
SINCE last_month
GRAIN day
```

Supported comparisons are `=`, `!=`, `IN`, `NOT IN`, `>`, `<`, `>=`, and `<=`. Use a list with `IN` to match several values:

```aql theme={"theme":{"light":"snazzy-light","dark":"github-dark"}}
WHERE experiment IN ["variant_a", "variant_b"]
```

### Time ranges and comparisons

Every query needs a time range, set with `SINCE`. Use a preset or a custom window.

| Form          | Example                             | Meaning                                        |
| ------------- | ----------------------------------- | ---------------------------------------------- |
| Preset        | `SINCE last_30d`                    | A rolling window ending today.                 |
| Custom window | `SINCE 2025-11-28 UNTIL 2025-12-01` | A fixed range, using ISO dates (`YYYY-MM-DD`). |

Available presets: `last_1d`, `last_7d`, `last_30d`, `last_90d`, `this_month`, `last_month`, and `this_year`.

* **`GRAIN`** sets the bucket size for time series — `hour`, `day`, `week`, or `month`.
* **`COMPARE`** overlays a second period so you can see change at a glance. Use `previous_period` (the equal-length window immediately before) or `previous_year` (the same window shifted back one year).

```aql theme={"theme":{"light":"snazzy-light","dark":"github-dark"}}
-- BFCM 2025 vs BFCM 2024
SELECT revenue, impressions, accept_rate
GROUP BY date
SINCE 2025-11-28 UNTIL 2025-12-01
GRAIN day
COMPARE previous_year
```

### Choosing a chart and timezone

These optional clauses are usually set for you by the Explorer's visual controls, but you can also write them directly:

* **`CHART`** sets how the result is displayed: `scorecard`, `line_chart`, `bar_chart`, `area_chart`, `funnel_chart`, or `table`.
* **`TIMEZONE`** sets the timezone used to bucket dates, as a quoted IANA name — for example `TIMEZONE "America/New_York"`. Defaults to UTC.

```aql theme={"theme":{"light":"snazzy-light","dark":"github-dark"}}
SELECT revenue
GROUP BY date
SINCE last_30d
GRAIN day
CHART line_chart
TIMEZONE "America/New_York"
```

The `funnel_chart` type has specific requirements:

* **Placement mode** — Group by `placement` and select one metric. Stages are ordered by the canonical placement sequence (upsell default → downsell → additional upsells). Only the first metric is plotted; additional selected metrics are noted in a footnote.
* **Metric mode** — Select two or more metrics with no `GROUP BY`. Each metric becomes a funnel stage in query order (for example, `SELECT impressions, conversions` shows an impressions → conversions drop-off). All metrics must share the same unit (for example, you cannot mix currency and percentage metrics).

```aql theme={"theme":{"light":"snazzy-light","dark":"github-dark"}}
-- Placement funnel: conversion drop-off across placements
SELECT impressions
GROUP BY placement
SINCE last_30d
CHART funnel_chart
```

```aql theme={"theme":{"light":"snazzy-light","dark":"github-dark"}}
-- Metric funnel: impressions to conversions drop-off
SELECT impressions, conversions
SINCE last_30d
CHART funnel_chart
```

### Sorting and limiting

* **`ORDER BY`** sorts results by a metric or dimension, with `ASC` or `DESC`.
* **`LIMIT`** caps the number of rows returned — useful for "top N" style questions.

```aql theme={"theme":{"light":"snazzy-light","dark":"github-dark"}}
-- Top 20 products by upsell revenue this month
SELECT revenue, conversions, avg_conversion_value
GROUP BY product
SINCE this_month
ORDER BY revenue DESC
LIMIT 20
```

### More examples

```aql theme={"theme":{"light":"snazzy-light","dark":"github-dark"}}
-- Daily performance vs the previous period
SELECT revenue, impressions, conversions, accept_rate
GROUP BY date
SINCE last_30d
GRAIN day
COMPARE previous_period
```

```aql theme={"theme":{"light":"snazzy-light","dark":"github-dark"}}
-- Mobile vs desktop accept rate over the last 90 days
SELECT impressions, accept_rate, rpv
GROUP BY device
SINCE last_90d
ORDER BY rpv DESC
```

```aql theme={"theme":{"light":"snazzy-light","dark":"github-dark"}}
-- Which surface is driving the most revenue?
SELECT revenue, impressions, accept_rate
GROUP BY surface
SINCE last_30d
ORDER BY revenue DESC
```

Once you have a query you like, save it and add it to a report as a widget so it keeps updating — see [Manage widgets](/aftersell/reports_widgets). To remove a widget you no longer need, load it in the Explorer and click **Delete** in the title bar. Deleting a widget removes it from every report it appears on. The **Delete** button is only shown for widgets you own; global template widgets are read-only.

***

## Timezone support

By default, queries run in UTC. You can override the timezone for any query directly in the Explorer toolbar, so that date-bucketed results (daily, weekly, monthly breakdowns) reflect your local time rather than UTC.

### Setting a timezone for a query

1. Open the Explorer in your Aftersell admin.
2. In the toolbar, click the **Timezone** selector (next to **Compare**).
3. Choose one of the available timezones from the list, or select **Account default** to use the timezone configured in your analytics settings.
4. Run your query. Results are bucketed using the selected timezone.

The selected timezone is saved with the query. When you save and reload a query, the timezone is restored automatically.

### Account default timezone

If you have **Lock reporting timezone** enabled in your analytics settings, selecting **Account default** in the toolbar uses that locked timezone for your query. The toolbar label shows the resolved zone, for example **Timezone: Account default (Paris (CET))**.

If **Lock reporting timezone** is not enabled, **Account default** falls back to UTC.

### Specifying a timezone in AQL

You can also specify a timezone directly in your AQL query using the `TIMEZONE` clause, which appears between `CHART` and `ORDER BY`:

```aql theme={"theme":{"light":"snazzy-light","dark":"github-dark"}}
SELECT ...
CHART ...
TIMEZONE "Asia/Tokyo"
ORDER BY ...
```

When present, the clause overrides the toolbar selection for that query. The timezone is preserved when you save and reload the query.

### Available timezones

The timezone picker includes the following options:

| Timezone             | Example location           |
| -------------------- | -------------------------- |
| UTC                  | Universal Coordinated Time |
| America/New\_York    | New York (ET)              |
| America/Chicago      | Chicago (CT)               |
| America/Denver       | Denver (MT)                |
| America/Los\_Angeles | Los Angeles (PT)           |
| America/Sao\_Paulo   | São Paulo (BRT)            |
| Europe/London        | London (GMT/BST)           |
| Europe/Paris         | Paris (CET/CEST)           |
| Asia/Dubai           | Dubai (GST)                |
| Asia/Tokyo           | Tokyo (JST)                |
| Australia/Sydney     | Sydney (AEST/AEDT)         |

### How timezone affects query results

When a timezone is set, date-bucketing in your query uses local time instead of UTC. For example, an event that occurred at `2026-03-29T01:30:00Z` (UTC) falls on March 28 in New York time (ET) but on March 29 in Paris time (CET). Setting the correct timezone ensures your daily, weekly, and monthly breakdowns match your business reporting expectations.

Queries that do not include a timezone — including previously saved queries — continue to run in UTC, so existing results are not affected.

***

## Need help?

If you have questions about the Explorer or want to enable access, contact the Aftersell support team through the in-app chat.
