- Events, Users, Sessions, Revenue, and Sources are first-party data scoped to your project.
- Wallet Profiles include public onchain data (net worth, apps, tokens, chains, social profiles, etc.) and are globally accessible across all workspaces.

- SQL dialect: ClickHouse SQL (not standard SQL)
- Default row limit: 100 rows (add your own
LIMITclause to override) - Project scoping: All queries are automatically filtered to your project — you never need to add
WHERE project_id = ... - Aggregate tables: Several tables use ClickHouse
AggregateFunctiontypes that require-Mergesuffix functions (see Working with Aggregate Tables)
Data flow
Tables
events
The core event log. Contains all user interaction events — page views, custom events, wallet connects, and onchain contract events (decoded_log).
Use cases: Event-level analysis, user journey tracking, custom event queries, debugging
| Column | Type | Description |
|---|---|---|
session_id | String | User session identifier |
channel | String | Event channel |
type | String | Event category: page, track, identify, connect, decoded_log |
anonymous_id | String | Auto-generated anonymous user ID |
user_id | String | Optional user identifier |
address | String | Wallet address (empty if not connected) |
event | String | Specific event name for track events |
context | String | JSON metadata: user_agent, page info, referrer. See contextual fields |
properties | String | JSON with event-specific custom properties. See event spec |
version | String | SDK version |
timestamp | DateTime | Event timestamp |
message_id | String | Unique event ID for deduplication |
origin | String | Domain (without www) |
locale | String | User locale |
location | String | Country code (e.g., US, DE) |
timezone | String | User timezone |
page_path | String | URL path |
page_title | String | Page title |
page_url | String | Full page URL |
page_query | String | URL query string |
page_hash | String | URL hash fragment |
library_name | String | SDK library name |
library_version | String | SDK library version |
referrer_url | String | Full referrer URL |
referrer | String | Referrer domain (without www) |
ref | String | Ref parameter |
utm_source | String | UTM source |
utm_medium | String | UTM medium |
utm_campaign | String | UTM campaign |
utm_term | String | UTM term |
utm_content | String | UTM content |
user_agent | String | Raw user agent string |
device | String | Device type: desktop, mobile-ios, mobile-android, tablet, bot |
browser | String | Browser: chrome, safari, firefox, or Web3 wallets |
os | String | OS: windows, ios, android, macos, linux |
users
Aggregated wallet user profiles with attribution, engagement, and revenue metrics. Each row represents one wallet address. Use cases: User segmentation, attribution analysis, lifecycle tracking, wallet analytics| Column | Type | Query Function |
|---|---|---|
address | String | Direct access |
first_seen | SimpleAggregateFunction(min, DateTime) | min(first_seen) |
last_seen | SimpleAggregateFunction(max, DateTime) | max(last_seen) |
first_utm_source | AggregateFunction(argMin, String, DateTime) | argMinMerge(first_utm_source) |
last_utm_source | AggregateFunction(argMax, String, DateTime) | argMaxMerge(last_utm_source) |
first_utm_medium | AggregateFunction(argMin, String, DateTime) | argMinMerge(first_utm_medium) |
last_utm_medium | AggregateFunction(argMax, String, DateTime) | argMaxMerge(last_utm_medium) |
first_utm_campaign | AggregateFunction(argMin, String, DateTime) | argMinMerge(first_utm_campaign) |
last_utm_campaign | AggregateFunction(argMax, String, DateTime) | argMaxMerge(last_utm_campaign) |
first_utm_content | AggregateFunction(argMin, String, DateTime) | argMinMerge(first_utm_content) |
last_utm_content | AggregateFunction(argMax, String, DateTime) | argMaxMerge(last_utm_content) |
first_utm_term | AggregateFunction(argMin, String, DateTime) | argMinMerge(first_utm_term) |
last_utm_term | AggregateFunction(argMax, String, DateTime) | argMaxMerge(last_utm_term) |
first_referrer | AggregateFunction(argMin, String, DateTime) | argMinMerge(first_referrer) |
last_referrer | AggregateFunction(argMax, String, DateTime) | argMaxMerge(last_referrer) |
first_referrer_url | AggregateFunction(argMin, String, DateTime) | argMinMerge(first_referrer_url) |
last_referrer_url | AggregateFunction(argMax, String, DateTime) | argMaxMerge(last_referrer_url) |
first_ref | AggregateFunction(argMin, String, DateTime) | argMinMerge(first_ref) |
last_ref | AggregateFunction(argMax, String, DateTime) | argMaxMerge(last_ref) |
num_sessions | AggregateFunction(uniq, String) | uniqMerge(num_sessions) |
revenue | SimpleAggregateFunction(sum, Float64) | sum(revenue) |
volume | SimpleAggregateFunction(sum, Float64) | sum(volume) |
points | SimpleAggregateFunction(sum, Float64) | sum(points) |
wallets_state | AggregateFunction(groupUniqArray, String) | groupUniqArrayMerge(wallets_state) |
last_type | AggregateFunction(argMax, String, DateTime) | argMaxMerge(last_type) |
last_event | AggregateFunction(argMax, String, DateTime) | argMaxMerge(last_event) |
last_properties | AggregateFunction(argMax, String, DateTime) | argMaxMerge(last_properties) |
location | AggregateFunction(argMax, String, DateTime) | argMaxMerge(location) |
device | AggregateFunction(argMax, String, DateTime) | argMaxMerge(device) |
browser | AggregateFunction(argMax, String, DateTime) | argMaxMerge(browser) |
os | AggregateFunction(argMax, String, DateTime) | argMaxMerge(os) |
activity_dates | AggregateFunction(groupUniqArray, Date) | groupUniqArrayMerge(activity_dates) |
activity_dates):
- New:
first_seenwithin 30 days - Churned:
last_seen>= 30 days ago - Power: 5+ unique active days in last 30 days
- Resurrected: had 30+ day gap but returned
- Returning: default
anonymous_users
Profiles for users who haven’t connected a wallet yet. Same structure asusers but keyed by anonymous_id instead of address.
Use cases: Pre-wallet user analysis, conversion funnel tracking, anonymous visitor segmentation
Total users =
users (wallet-connected) + anonymous_users (pre-wallet)| Column | Type | Query Function |
|---|---|---|
anonymous_id | String | Direct access |
anonymous_id replacing address as the primary key.
sessions
Aggregated session data with engagement metrics and attribution. Each row represents one session on a given date. Use cases: Session analysis, bounce rate calculations, session duration, user attribution| Column | Type | Query Function |
|---|---|---|
origin | String | Direct access |
session_id | String | Direct access |
date | Date | Direct access |
device | SimpleAggregateFunction(any, String) | Direct access |
browser | SimpleAggregateFunction(any, String) | Direct access |
os | SimpleAggregateFunction(any, String) | Direct access |
location | SimpleAggregateFunction(any, String) | Direct access |
referrer | SimpleAggregateFunction(any, String) | Direct access |
ref | SimpleAggregateFunction(any, String) | Direct access |
utm_medium | SimpleAggregateFunction(any, String) | Direct access |
utm_source | SimpleAggregateFunction(any, String) | Direct access |
utm_campaign | SimpleAggregateFunction(any, String) | Direct access |
utm_content | SimpleAggregateFunction(any, String) | Direct access |
utm_term | SimpleAggregateFunction(any, String) | Direct access |
first_hit | SimpleAggregateFunction(min, DateTime) | Direct access |
latest_hit | SimpleAggregateFunction(max, DateTime) | Direct access |
hits | AggregateFunction(count) | countMerge(hits) |
sources
Daily aggregated traffic source metrics and attribution data. Each row represents one day of activity from a specific referrer/UTM combination. Use cases: Marketing attribution, referrer performance, traffic source analysis, campaign ROI| Column | Type | Description |
|---|---|---|
date | Date | Activity date |
origin | String | Site domain |
referrer | String | Referrer domain |
referrer_url | String | Full referrer URL |
device | String | Device type |
browser | String | Browser |
os | String | Operating system |
location | String | Country code |
ref | String | Ref parameter |
utm_medium | String | UTM medium |
utm_source | String | UTM source |
utm_campaign | String | UTM campaign |
utm_content | String | UTM content |
utm_term | String | UTM term |
visits | AggregateFunction(uniq, String) | Unique sessions — use uniqMerge(visits) |
users | AggregateFunction(uniq, String) | Unique anonymous users — use uniqMerge(users) |
hits | AggregateFunction(count) | Page views — use countMerge(hits) |
revenue
Financial metrics with full attribution context. Tracks revenue, transaction volume, and points. Use cases: Revenue attribution, ROI analysis, financial performance by source/campaign| Column | Type | Description |
|---|---|---|
origin | String | Site domain |
pathname | String | Page path |
date | Date | Transaction date |
device | String | Device type |
browser | String | Browser |
os | String | Operating system |
location | String | Country code |
referrer_url | String | Full referrer URL |
referrer | String | Referrer domain |
ref | String | Ref parameter |
utm_medium | String | UTM medium |
utm_source | String | UTM source |
utm_campaign | String | UTM campaign |
utm_content | String | UTM content |
utm_term | String | UTM term |
event | String | Revenue-generating event name |
rdns | String | Wallet RDNS identifier |
provider_name | String | Wallet provider name |
chain_id | String | Blockchain chain ID |
volume | Float32 | Transaction volume (capped at 1B) |
revenue | Float32 | Revenue value (capped at 1B) |
points | Float32 | Points value (capped at 1B) |
identities
Identity graph linking anonymous sessions to wallet addresses. Each row represents a connection between an anonymous user and a wallet. Use cases: Conversion tracking, user journey analysis, linking pre/post-wallet activity| Column | Type | Query Function |
|---|---|---|
session_id | String | Direct access |
anonymous_id | String | Direct access |
address | String | Wallet address |
user_id | String | Optional user identifier |
first_seen | AggregateFunction(min, DateTime) | minMerge(first_seen) |
wallet_profiles_mv
Global wallet profile data aggregated across all chains. One row per wallet address with social profiles, contact info, and net worth. Use cases: Wallet intelligence, social identity resolution, user enrichment, outreach| Column | Type | Query Function |
|---|---|---|
address | String | Direct access |
net_worth_usd | AggregateFunction(argMax, Float64, DateTime) | argMaxMerge(net_worth_usd) |
ens | SimpleAggregateFunction(max, String) | Direct access |
farcaster | SimpleAggregateFunction(max, String) | Direct access |
lens | SimpleAggregateFunction(max, String) | Direct access |
basenames | SimpleAggregateFunction(max, String) | Direct access |
linea | SimpleAggregateFunction(max, String) | Direct access |
discord | SimpleAggregateFunction(max, String) | Direct access |
telegram | SimpleAggregateFunction(max, String) | Direct access |
website | SimpleAggregateFunction(max, String) | Direct access |
github | SimpleAggregateFunction(max, String) | Direct access |
twitter | SimpleAggregateFunction(max, String) | Direct access |
linkedin | SimpleAggregateFunction(max, String) | Direct access |
email | SimpleAggregateFunction(max, String) | Direct access |
instagram | SimpleAggregateFunction(max, String) | Direct access |
facebook | SimpleAggregateFunction(max, String) | Direct access |
tiktok | SimpleAggregateFunction(max, String) | Direct access |
youtube | SimpleAggregateFunction(max, String) | Direct access |
reddit | SimpleAggregateFunction(max, String) | Direct access |
avatar | SimpleAggregateFunction(max, String) | Direct access |
description | SimpleAggregateFunction(max, String) | Direct access |
display_name | SimpleAggregateFunction(max, String) | Direct access |
location | SimpleAggregateFunction(max, String) | Direct access |
updated_at | SimpleAggregateFunction(max, DateTime) | Direct access |
wallet_profiles_chains_mv
Wallet profile data broken down by blockchain network. Each row represents a wallet’s activity on a specific chain. Use cases: Chain-specific analysis, cross-chain behavior tracking, multi-chain user segmentation| Column | Type | Query Function |
|---|---|---|
address | String | Direct access |
chain_id | String | Blockchain identifier |
net_worth_usd | AggregateFunction(argMax, Float64, DateTime) | argMaxMerge(net_worth_usd) |
tx_count | AggregateFunction(argMax, UInt64, DateTime) | argMaxMerge(tx_count) |
first_onchain | SimpleAggregateFunction(min, Nullable(DateTime)) | Direct access |
last_onchain | SimpleAggregateFunction(max, Nullable(DateTime)) | Direct access |
updated_at | SimpleAggregateFunction(max, DateTime) | Direct access |
wallet_profiles_chains_tokens_mv
Token holdings data per wallet per chain. Each row represents one token held by a wallet on a specific chain. Use cases: Token portfolio analysis, token-based segmentation, whale identification| Column | Type | Query Function |
|---|---|---|
address | String | Direct access |
chain_id | String | Blockchain identifier |
token_address | String | Token contract address |
app_id | String | DeFi app ID (if token is in a protocol) |
name | AggregateFunction(argMax, String, DateTime) | argMaxMerge(name) |
symbol | AggregateFunction(argMax, String, DateTime) | argMaxMerge(symbol) |
img | AggregateFunction(argMax, String, DateTime) | argMaxMerge(img) |
decimals | AggregateFunction(argMax, Float64, DateTime) | argMaxMerge(decimals) |
price | AggregateFunction(argMax, Float64, DateTime) | argMaxMerge(price) |
balance | AggregateFunction(argMax, Float64, DateTime) | argMaxMerge(balance) |
balance_usd | AggregateFunction(argMax, Float64, DateTime) | argMaxMerge(balance_usd) |
updated_at | SimpleAggregateFunction(max, DateTime) | Direct access |
wallet_profiles_chains_apps_mv
DeFi app usage data per wallet per chain. Each row represents a wallet’s interaction with a specific DeFi protocol. Use cases: DeFi app adoption analysis, protocol usage tracking, user portfolio analysis| Column | Type | Query Function |
|---|---|---|
address | String | Direct access |
chain_id | String | Blockchain identifier |
id | String | Unique app identifier |
name | AggregateFunction(argMax, String, DateTime) | argMaxMerge(name) |
img | AggregateFunction(argMax, String, DateTime) | argMaxMerge(img) |
url | AggregateFunction(argMax, String, DateTime) | argMaxMerge(url) |
balance_usd | AggregateFunction(argMax, Float64, DateTime) | argMaxMerge(balance_usd) |
updated_at | SimpleAggregateFunction(max, DateTime) | Direct access |
wallet_profiles_events
Raw timestamped wallet profile data from blockchain analysis. Contains the unprocessed profile updates that feed into thewallet_profiles_* materialized views.
Use cases: Debugging wallet profile data, historical profile snapshots, raw data access
| Column | Type | Description |
|---|---|---|
address | String | Wallet address |
type | String | Event type: wallet_profile_set or wallet_profile_chain_set |
chain_id | String | Blockchain identifier |
version | String | Profile data version |
properties | String | JSON with detailed profile data (tokens, balances, tx history) |
timestamp | DateTime | When the profile was captured |
chains
Derived view providing chain usage data with attribution context. Use cases: Chain adoption tracking, multi-chain user analysis| Column | Type | Description |
|---|---|---|
chain_id | String | Blockchain identifier |
date | DateTime | Activity date |
origin | String | Site domain |
device | String | Device type |
browser | String | Browser |
os | String | Operating system |
location | String | Country code |
referrer | String | Referrer domain |
ref | String | Ref parameter |
utm_medium | String | UTM medium |
utm_source | String | UTM source |
utm_campaign | String | UTM campaign |
utm_content | String | UTM content |
utm_term | String | UTM term |
visits | String | Visit count |
pages
Derived view providing page-level analytics data. Use cases: Page performance analysis, content analytics, top pages| Column | Type | Description |
|---|---|---|
origin | String | Site domain |
pathname | String | URL path |
visits | Number | Unique session count |
hits | Number | Total page views |
Table relationships
anonymous_id and session_id to address, enabling you to track user behavior before and after wallet connection.
Functions
Custom SQL functions that resolve at query time. Functions use the{{ function_name(...) }} syntax — the macro is expanded into a numeric literal before your query runs, so results can be used anywhere a number would be (SELECT, WHERE, arithmetic, etc.).
Rules:
- Maximum 10 function calls per query
- Results are cached for 15 minutes
Price oracle functions
Fetch live token prices directly inside your SQL queries. Use these to convert token amounts to USD values without joining external price data manually.alchemy.token_price
Get token price by contract address and chain ID from Alchemy.
Signature: {{ alchemy.token_price('ADDRESS', CHAIN_ID, 'CURRENCY') }}
Parameters:
ADDRESS— EVM contract address (0x-prefixed, 42 characters)CHAIN_ID— Numeric chain ID (e.g.,1for Ethereum,8453for Base,42161for Arbitrum)CURRENCY— One ofusd,eur,eth,btc
alchemy.token_price_by_symbol
Get token price by symbol from Alchemy.
Signature: {{ alchemy.token_price_by_symbol('SYMBOL', 'CURRENCY') }}
Parameters:
SYMBOL— Token symbol (e.g.,ETH,BTC,SOL)CURRENCY— One ofusd,eur,eth,btc
pyth.token_price
Get token price by pair name from Pyth.
Signature: {{ pyth.token_price('BASE/QUOTE') }}
Parameters:
BASE/QUOTE— Price pair (e.g.,ETH/USD,BTC/USD,SOL/USD)
Variables
Template variables are replaced with actual values at query time. Use them to build charts and dashboards that respond to a shared date picker instead of hardcoded ranges.Date range variables
{{date_from}}
Start date of the selected date range. Replaced with a YYYY-MM-DD string at query time.
Example:
{{date_to}}
End date of the selected date range. Replaced with a YYYY-MM-DD string at query time.
Example:
Working with aggregate tables
Several tables (users, anonymous_users, sessions, sources, identities) use ClickHouse AggregateFunction types. These store intermediate aggregation states, not final values.
Rules
- Always
GROUP BYthe primary key when querying aggregate tables - Use
-Mergesuffix forAggregateFunctioncolumns (e.g.,argMaxMerge(last_utm_source)) - Use standard functions for
SimpleAggregateFunctioncolumns (e.g.,min(first_seen),max(last_seen)) - Never
SELECT *on aggregate tables — it returns binary aggregate states, not readable values
Quick reference
| Aggregate Type | Query Pattern | Example |
|---|---|---|
AggregateFunction(argMax, T, DateTime) | argMaxMerge(col) | argMaxMerge(location) |
AggregateFunction(argMin, T, DateTime) | argMinMerge(col) | argMinMerge(first_utm_source) |
AggregateFunction(uniq, T) | uniqMerge(col) | uniqMerge(num_sessions) |
AggregateFunction(count) | countMerge(col) | countMerge(hits) |
AggregateFunction(groupUniqArray, T) | groupUniqArrayMerge(col) | groupUniqArrayMerge(wallets_state) |
AggregateFunction(min, T) | minMerge(col) | minMerge(first_seen) |
SimpleAggregateFunction(min, T) | min(col) | min(first_seen) |
SimpleAggregateFunction(max, T) | max(col) | max(last_seen) |
SimpleAggregateFunction(sum, T) | sum(col) | sum(revenue) |
SimpleAggregateFunction(any, T) | Direct access | device |
Example queries
Most active wallets
Daily active users
Average session duration
Events by type
Revenue by UTM campaign
Top countries by session count
Sessions by device and browser
Enrich users with social profiles
Top DeFi apps of US users
High net worth DeFi positions
Track user journey across anonymous and wallet sessions
Next steps
SQL Explorer Guide
Step-by-step guide to writing queries
Ask AI
Generate SQL with natural language
BI Integration
Connect Metabase, Grafana, and more
Query API
Query data programmatically