Skip to main content
Use the same query standards from the SQL Query Library overview: is_order_sm_valid = TRUE for order analyses, sm_store_id scoping for multi-store setups, and your_project placeholders.
Click/impression-based ratios such as CPC, CTR, and CPM are only meaningful when the underlying click or impression metric is available. For TikTok, exclude ad_campaign_type = 'gmv_max' when you need ordinary TikTok Ads metrics because GMV Max rows can carry spend without clicks or impressions.
What you’ll learn: How much you’re spending to acquire each new customer, broken down by channel. Use this to identify which channels are most cost-efficient and where you might be overspending on acquisition.
What you’ll learn: Which ad platform and campaign type combinations are generating the best return on ad spend. Helps you decide where to allocate more budget and which underperforming campaigns to optimize or cut.
What you’ll learn: Which TikTok campaign types have spend, clicks, and impressions available. Use this before calculating CPC, CTR, or CPM across TikTok so GMV Max spend does not distort ordinary TikTok Ads metrics.
For TikTok Ads-only CPC, CTR, and CPM, add AND ad_campaign_type != 'gmv_max' to the WHERE clause.

Back to the SQL Query Library.

Messaging

Compare paid performance with owned-channel outcomes.

Orders & Revenue

Connect media efficiency to order and revenue quality.

Attribution & Data Health

Validate tracking quality before channel-level decisions.