All Skills

Knowledge base for SEM and ecommerce metrics, KPIs, and business intelligence. Covers Google Ads, GA4, Meta Ads, product feed data models, revenue metrics, ROAS calculations, and multi-channel attribution. Load when working with ecommerce analytics or scoring model metrics.

E
$npx skills add Expanly/expanly-claude-code-agents --skill sem-ecommerce-metrics

SEM & Ecommerce Metrics Reference

This skill provides domain knowledge for Search Engine Marketing (SEM), paid social, and ecommerce analytics. Use this to understand how metrics flow from ad platforms through analytics to business outcomes.


Core Data Sources

Product Feed (Merchant Center / Catalog)

The master product catalog containing:

FieldDescriptionUse
g_id / idVariant ID (SKU)Unique identifier per size/color
g_item_group_idProduct IDGroups variants together
g_titleProduct titleDisplay name
g_pricePriceCurrent selling price
g_sale_priceSale priceDiscounted price (optional)
g_availabilityStock status"in_stock" or "out_of_stock"
g_brandBrand nameFiltering/segmentation
g_product_typeCategory pathTaxonomy
g_custom_label_*Custom labels (0-4)Campaign segmentation

Key Concepts:

  • Variant vs Product: One product (shoes) has many variants (sizes)
  • item_group_id: Groups all variants of same product
  • Custom Labels: Used to segment products in ad campaigns

Google Analytics 4 (GA4)

User behavior and conversion data:

MetricDescriptionAggregation
itemRevenueRevenue attributed to itemSUM
itemPurchaseQuantityUnits soldSUM
itemsViewedProduct detail page viewsSUM
itemsAddedToCartAdd to cart eventsSUM
itemsCheckedOutCheckout initiationsSUM

Key Concepts:

  • Attribution: Revenue attributed to last-click item
  • Item ID matching: GA4 uses item_id field
  • Aggregated "(other)": Low-volume items grouped together
  • Data freshness: 7-day refresh window

Ad performance and cost data:

MetricDescriptionAggregation
CostAd spendSUM
ClicksAd clicksSUM
ImpressionsAd impressionsSUM
ConversionsAttributed conversionsSUM
ConversionValueRevenue from conversionsSUM

Key Concepts:

  • OfferId: Maps to product feed g_id
  • Attribution window: Default 30 days
  • Fractional conversions: Multi-touch attribution
  • Data freshness: 60-day refresh window

Meta (Facebook/Instagram) Ads

Paid social performance:

MetricDescriptionAggregation
spendAd spendSUM
purchasesPurchase conversionsSUM
purchase_valueRevenueSUM
impressionsAd impressionsSUM
clicksAd clicksSUM

Key Concepts:

  • Product-level attribution: At item_group_id level
  • Data freshness: 14-day retention window only
  • Pixel attribution: 7-day click, 1-day view default

Key Metrics & KPIs

Revenue Metrics

MetricFormulaUse
RevenueSUM(item_revenue)Total sales attributed
AOVRevenue / OrdersAverage order value
Revenue per ClickRevenue / ClicksClick efficiency

Cost Metrics

MetricFormulaUse
Ad SpendSUM(cost)Total advertising cost
CPCCost / ClicksCost per click
CPM(Cost / Impressions) × 1000Cost per thousand impressions

Efficiency Metrics

MetricFormulaGoodBad
ROASRevenue / Cost> 3.0< 1.0
CPACost / ConversionsLowHigh
CVRConversions / Clicks> 2%< 0.5%

Engagement Metrics (GA4)

MetricFormulaBenchmark
Add-to-Cart RateATC / Views> 5%
View VelocityViews_short / Views_long> 0.35 = trending
Checkout RateCheckouts / ATC> 30%

Time Windows

Metrics are aggregated over different time periods:

WindowDurationPurpose
_yest1 dayYesterday's performance
_short7-14 daysShort-term trends, seasonality
_long30-60 daysLong-term reliability

Why multiple windows?

  • Short window captures trends but has noise
  • Long window is stable but masks recent changes
  • Combined view enables trend detection

Product Performance Segmentation

By Revenue Contribution

SegmentCriteriaAction
Top PerformersTop 10% revenueBoost bids
Core Products10-50% percentileMaintain
Long TailBottom 50%Monitor
Zero RevenueNo salesEvaluate

By ROAS

SegmentROASAction
Profitable> 3.0Scale
Breakeven1.0-3.0Optimize
Unprofitable< 1.0Reduce/exclude
NegativeRevenue < CostExclude

By Stock Status

SegmentCriteriaAction
In Stockavailability = "in_stock"Advertise
Low Stock< 50% variants availableReduce exposure
Out of Stockavailability = "out_of_stock"Exclude

Multi-Channel Attribution

Channel Priority for Scoring

When a product performs differently across channels:

  1. Google Ads - Most direct conversion attribution
  2. GA4 - Captures all traffic sources
  3. Meta - Social discovery, upper funnel

Top Seller Definition

A product is a "top seller" if it's in the top 10% for ANY channel:

CASE
  WHEN ga4_revenue_percentile >= 0.90
    OR gads_revenue_percentile >= 0.90
    OR meta_revenue_percentile >= 0.90
  THEN TRUE
END AS is_top_seller

ROAS Calculation by Channel

-- Google Ads ROAS
SAFE_DIVIDE(gads_conversion_value, gads_cost) AS gads_roas

-- Meta ROAS
SAFE_DIVIDE(meta_purchase_value, meta_spend) AS meta_roas

-- Blended ROAS
SAFE_DIVIDE(
  gads_conversion_value + meta_purchase_value,
  gads_cost + meta_spend
) AS blended_roas

Trend Detection

View Velocity

Compares recent views to historical views:

SAFE_DIVIDE(ga4_views_short, ga4_views_long) AS view_velocity
-- > 0.35 indicates upward trend (14d vs 60d)
-- < 0.15 indicates declining interest
CASE
  WHEN view_velocity > 0.35 AND atc_rate > 0.035
  THEN TRUE
END AS is_trending

Data Quality Considerations

ID Matching Issues

ProblemCauseSolution
Case mismatchGA4 mixed, Ads lowercaseUPPER(TRIM(id))
Encoding issuesURL encodingDecode before matching
Variant vs ProductDifferent granularityUse item_group_id

Metric Reliability

Metrics need sufficient volume to be meaningful:

MetricMinimum VolumeReason
ROASCost > $10Avoid noise
CVRClicks > 100Statistical significance
ATC RateViews > 50Stable calculation

Data Freshness

SourceLookbackConsideration
GA47 daysRecent conversions may update
Google Ads60 daysLong attribution window
Meta14 daysSHORT RETENTION - snapshot needed

Business Context

Dynamic Remarketing Campaigns

Products are segmented into campaigns by performance:

PriorityProductsBid Strategy
HighTop sellers, high ROASMaximize conversions
StandardUnclassifiedTarget ROAS
LowPoor performersMinimize spend

Custom Labels (0-4)

Used to segment products in Google Merchant Center:

LabelTypical Use
custom_label_0Priority tier (HIGH/STANDARD/LOW)
custom_label_1Performance segment (TOP_SELLER, etc.)
custom_label_2Category
custom_label_3Season/Campaign
custom_label_4Stock status

Analysis Patterns

Find Top Performers

SELECT item_group_id, SUM(revenue) AS total_revenue
FROM metrics
GROUP BY item_group_id
ORDER BY total_revenue DESC
LIMIT 100

Identify Wasted Ad Spend

SELECT
  item_group_id,
  SUM(CASE WHEN NOT is_in_stock THEN gads_cost ELSE 0 END) AS wasted_spend
FROM metrics
WHERE date >= DATE_SUB(CURRENT_DATE(), INTERVAL 30 DAY)
GROUP BY item_group_id
HAVING wasted_spend > 10
ORDER BY wasted_spend DESC

Channel Mix Analysis

SELECT
  item_group_id,
  SUM(ga4_revenue) AS ga4_revenue,
  SUM(gads_revenue) AS gads_revenue,
  SUM(meta_revenue) AS meta_revenue,
  SAFE_DIVIDE(SUM(gads_revenue), SUM(ga4_revenue)) AS gads_attribution_rate
FROM metrics
GROUP BY item_group_id