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

# Querying Data in Upstack Analytics

> Query events, sessions, and attribution data in Upstack Analytics — build reports with measures and dimensions, filter by channel and campaign, and export results for further analysis.

Upstack Analytics gives you direct access to your identity-resolved, enriched event data. You can explore traffic patterns, measure conversion funnels, compare channel performance, and build custom reports — all from a single dashboard backed by your first-party data.

<Tip>
  Unlike ad platform dashboards that only show their own ecosystem, Upstack Analytics queries your unified event stream. You see every channel, every touchpoint, and every conversion in one place with consistent measurement.
</Tip>

## What You Can Query

Upstack Analytics organizes data into three primary views:

### Events

Query raw events with filters and aggregations. Useful for:

* Counting events by type over time (e.g., "How many AddToCart events this week?")
* Filtering by event properties (e.g., "All Purchase events where `value` > \$100")
* Grouping by dimensions (e.g., "PageViews by device type and country")

### Sessions

Query session-level metrics that aggregate events into browsing sessions. Useful for:

* Understanding engagement patterns (session duration, pages per session, bounce rate)
* Comparing session quality across traffic sources
* Identifying high-intent sessions that didn't convert

### Attribution

Query attribution data that assigns conversion credit across marketing touchpoints. Useful for:

* Comparing channel performance across attribution models
* Calculating true ROAS per channel
* Identifying which campaigns drive the highest-value customers

## Using the Query Builder

The Upstack Analytics dashboard provides a visual query builder that lets you construct queries without writing SQL.

### 1. Select Your Measures

Measures are the numeric values you want to calculate. Choose one or more:

* **Total Events** — Count of events matching your filters
* **Unique Visitors** — Distinct identity count
* **Revenue** — Sum of Purchase event values
* **Conversion Rate** — Purchases divided by sessions
* **Average Order Value** — Revenue divided by purchase count

See [Measures & Dimensions](/data-dictionary/measures-and-dimensions) for the full list.

### 2. Choose Your Dimensions

Dimensions break down your measures into categories:

* **Date** — Time-series view (daily, weekly, monthly)
* **UTM Source** — Group by traffic source
* **Device Type** — Compare mobile vs. desktop
* **Country** — Geographic breakdown
* **Event Name** — Group by event type

### 3. Set Date Range

Select a predefined range or set custom start and end dates:

| Preset       | Range                   |
| ------------ | ----------------------- |
| Today        | Current day             |
| Last 7 days  | Rolling 7-day window    |
| Last 30 days | Rolling 30-day window   |
| This month   | Calendar month to date  |
| Last month   | Previous calendar month |
| Custom       | Any start and end date  |

All dates are in UTC. Data is available within minutes of the event occurring.

### 4. Apply Filters

Narrow your results with filters on any dimension or event property:

* `utm_source = facebook` — Only Facebook traffic
* `device_type = mobile` — Only mobile visitors
* `event_name = Purchase` — Only purchase events
* `country = US` — Only US visitors
* `value > 50` — Only events with value above \$50

Filters can be combined with AND logic. Multiple values for the same field use OR logic (e.g., `utm_source = facebook OR google`).

### 5. Set Grouping

Choose how to group your results. You can group by one or more dimensions:

* **Single dimension:** Revenue by `utm_source` → bar chart comparing channels
* **Two dimensions:** Revenue by `utm_source` and `date` → time series per channel
* **No grouping:** Single aggregate number across all matching data

## Reading Results

Query results are displayed as both a chart and a data table. You can:

* **Toggle chart types** — Line, bar, or table view
* **Export data** — Download results as CSV for further analysis
* **Save as report** — Save the query configuration for quick access later
* **Share** — Generate a shareable link to the report

<Note>
  Saved reports update automatically. When you open a saved report, it re-executes the query against the latest data with the same filters, dimensions, and date range logic.
</Note>

## Common Query Patterns

**Conversion funnel:** Select measures for PageViews, AddToCart, InitiateCheckout, and Purchase counts. Group by date to see the funnel over time.

**Channel comparison:** Select Revenue and Conversion Rate. Group by `utm_source`. Filter to last 30 days. Compare which channels drive the most efficient revenue.

**Device breakdown:** Select Sessions and Bounce Rate. Group by `device_type`. Identify whether mobile experience needs optimization.

**Top pages:** Select PageViews and Unique Visitors. Group by `page_path`. Sort by PageViews descending to find your highest-traffic pages.

<CardGroup cols={2}>
  <Card title="Measures & Dimensions" icon="ruler-combined" href="/data-dictionary/measures-and-dimensions">
    Full reference for every measure and dimension available in the query builder.
  </Card>

  <Card title="Session & Page Analytics" icon="chart-line" href="/analytics/session-and-page-analytics">
    Dive deeper into session-level and page-level metrics.
  </Card>

  <Card title="Attribution Reporting" icon="chart-pie" href="/analytics/attribution-reporting">
    Compare attribution models and understand channel credit allocation.
  </Card>

  <Card title="Event Taxonomy" icon="bolt" href="/data-dictionary/event-taxonomy">
    Review the standard events that feed your analytics queries.
  </Card>
</CardGroup>
