xmetric / Use cases

Join GA4 Traffic Acquisition CSVs with Ad Spend to Measure ROAS

You can calculate return on ad spend (ROAS) and customer acquisition cost (CAC) from Google Analytics 4 by exporting a GA4 Traffic acquisition CSV that includes imported cost data. Drop it on this page for a first chart, then build the channel table in the free xmetric app (/app/) with the CAC and ROAS formulas below. Joining a separate ad spend CSV is coming. Your file stays in your browser.

Chart your own CSV

Chart your export here

Drop a CSV here. xmetric reads every row in this browser and draws a first chart you can regroup or change the measure of. Nothing is uploaded.

No file loaded yet. You can also drop a CSV on this box.

How to export GA4 Traffic acquisition data for spend blending

Google Analytics 4 imports Google Ads cost automatically when linked, but non-Google channels (Meta Ads, LinkedIn Ads, sponsorships) require manual cost imports via Campaign data import (utm_source and utm_medium) or an external join.

  1. In Google Analytics 4, open Reports > Acquisition > Traffic acquisition.
  2. Switch the primary dimension dropdown from Session primary channel group (Default Channel Group) to Session source / medium or Session campaign, and add Date or Month as a secondary dimension by clicking the + button.
  3. Click Share this report > Download File > Download CSV (exports up to 100,000 rows as of October 2026).
GA4 Export Column NameData TypePurpose in Attribution View
Session primary channel group (Default Channel Group)StringHigh-level channel rollup (Paid Search, Organic Search, Direct, Paid Social)
Session source / mediumStringJoin key with UTM tags (for example google / cpc, meta / paid_social)
Session campaignStringJoin key with ad platform campaign names (utm_campaign)
SessionsIntegerTotal session visits per channel
Engaged sessionsIntegerSessions lasting >10 seconds, 2+ screens/pages, or triggering a key event
Key eventsIntegerAttributed conversion events for the session
Total revenueCurrencyAttributed ecommerce or event value

Key attribution formulas and SQL equivalents

1. Channel Customer Acquisition Cost (CAC) and ROAS

Once your GA4 CSV with cost data is open in the xmetric app, compute effective CAC and ROAS side by side as calculated fields. (Joining a separate ad spend CSV on normalized campaign and month is coming.)

xmetric / Tableau formula (CAC):

SUM([Ad Spend]) / NULLIF(SUM([Key events]), 0)

xmetric / Tableau formula (ROAS):

SUM([Total revenue]) / NULLIF(SUM([Ad Spend]), 0)

SQL equivalent:

SELECT
  g."Session source / medium" AS source_medium,
  g."Session campaign" AS campaign,
  SUM(s.spend_usd) AS ad_spend,
  SUM(g."Sessions") AS sessions,
  SUM(g."Key events") AS key_events,
  SUM(g."Total revenue") AS revenue,
  SUM(s.spend_usd) / NULLIF(SUM(g."Key events"), 0) AS cac,
  SUM(g."Total revenue") / NULLIF(SUM(s.spend_usd), 0) AS roas
FROM ga4_traffic_acquisition g
LEFT JOIN ad_spend_csv s
  ON LOWER(TRIM(g."Session campaign")) = LOWER(TRIM(s.campaign_name))
GROUP BY 1, 2
ORDER BY ad_spend DESC;

2. Share of Spend vs. Share of Key Events (FIXED LOD)

Spot channels that consume a large share of paid budget while delivering a small share of total conversions.

xmetric / Tableau formula:

(SUM([Key events]) / MIN({ FIXED : SUM([Key events]) }))
- (SUM([Ad Spend]) / MIN({ FIXED : SUM([Ad Spend]) }))

SQL equivalent:

SELECT
  "Session primary channel group (Default Channel Group)" AS channel_group,
  SUM("Key events") * 1.0 / NULLIF(SUM(SUM("Key events")) OVER (), 0) AS share_of_key_events,
  SUM(ad_spend) * 1.0 / NULLIF(SUM(SUM(ad_spend)) OVER (), 0) AS share_of_spend
FROM joined_channel_data
GROUP BY 1;

3. Cost per Engaged Session (Quality-Adjusted CPC)

Ad platforms report cost per link click, which ignores visitors who bounce before the page loads. Dividing spend by GA4 Engaged sessions reveals true cost per qualified visit.

xmetric / Tableau formula:

SUM([Ad Spend]) / NULLIF(SUM([Engaged sessions]), 0)

Where GA4 native attribution and paid connectors differ

Questions people ask

How do I fix mismatched campaign names between GA4 and Meta Ads?

Use a calculated field in xmetric with LOWER(TRIM([Session campaign])) on both tables, or map via utm_id if your ad URLs pass campaign IDs.

Why do GA4 Key events not match conversions reported in Meta Ads Manager?

Meta Ads Manager defaults to a 7-day click and 1-day view attribution window, crediting view-through conversions that never clicked a link. GA4 Traffic acquisition only counts sessions where the user clicked through to your site with UTM parameters.

Can I analyze the channel view without uploading my financial numbers?

Yes. Files you drop are read in your browser and nothing is uploaded, unless you sign in and save a workbook online.

Will xmetric support live BigQuery or Postgres marketing warehouse connections?

Yes, they are coming. Live connections to BigQuery and Postgres are in development, along with an xmetric MCP server, ChatGPT app and Claude connector that will let agents query your attribution tables directly.

Drop your GA4 Traffic_acquisition.csv above for a first chart, then build the CAC, ROAS and cost per engaged session view in the xmetric app.