Skip to main content
Last updated: March 18, 2026

The Problem

Every marketing platform uses its own naming convention for fields:
Google Ads:    campaign.name, ad_group.name, metrics.clicks
Meta Ads:      campaign_name, adset_name, clicks
GA4:           sessionSourceMedium, totalUsers
Pinterest:     CAMPAIGN_NAME, TOTAL_IMPRESSION
Shopify:       orderCount, grossSales
Writing SQL across platforms means constantly remembering which convention each platform uses — and dealing with dots, camelCase, and inconsistent capitalization.

The Solution

Detrics normalizes all column names to snake_case before loading data into BigQuery. This means every platform’s fields follow the same convention, and you can write clean cross-platform SQL without worrying about naming differences.

Normalization Rules

Detrics applies these rules in order:
RuleBeforeAfter
Dots become underscorescampaign.namecampaign_name
camelCase splitscampaignNamecampaign_name
ALL_CAPS lowercasedCAMPAIGN_NAMEcampaign_name
Acronyms loweredCTRctr
Letter-digit boundariesvideoViewsP25video_views_p25
Consecutive underscores collapsedcampaign__namecampaign_name
Leading/trailing underscores stripped_campaign_name_campaign_name
Digit-leading names prefixed7day_click_7day_click

Examples

Before and After

PlatformOriginal FieldBigQuery Column
Google Adscampaign.namecampaign_name
Google Adsmetrics.cost_microsmetrics_cost_micros
Meta Adscampaign_namecampaign_name
GA4sessionSourceMediumsession_source_medium
GA4totalUserstotal_users
PinterestCAMPAIGN_NAMEcampaign_name
PinterestTOTAL_IMPRESSIONtotal_impression
ShopifygrossSalesgross_sales
ShopifyorderCountorder_count
TikTokcampaign_namecampaign_name
Meta Adsoffsite_conversion.fb_pixel_purchaseoffsite_conversion_fb_pixel_purchase

Cross-Platform SQL

With normalized column names, cross-platform queries become straightforward:
-- Compare spend across Meta Ads and Google Ads
SELECT
  'Meta Ads' as platform,
  campaign_name,
  SUM(spend) as total_spend
FROM `project.dataset.meta_ads_campaigns`
WHERE date >= '2026-03-01'
GROUP BY campaign_name

UNION ALL

SELECT
  'Google Ads' as platform,
  campaign_name,
  SUM(spend) as total_spend
FROM `project.dataset.google_ads_campaigns`
WHERE date >= '2026-03-01'
GROUP BY campaign_name

ORDER BY total_spend DESC

System Columns

System columns added by Detrics always use the _detrics_ prefix and are already in snake_case:
  • _detrics_account_id
  • _detrics_row_id
  • _detrics_sync_id
  • _detrics_synced_at
These are never affected by normalization rules and are consistent across all tables.

Type Mapping

In addition to name normalization, Detrics maps platform data types to BigQuery-native types:
Detrics TypeBigQuery Type
stringSTRING
float, float64FLOAT64
integer, int64INT64
dateDATE
datetimeDATETIME
timestampTIMESTAMP
booleanBOOL
percentFLOAT64
currencyFLOAT64
numberFLOAT64