What this means for your store
Merchandising systems, marketplace feeds, and legacy PIM exports rarely agree on SKU format - but GA4 expects consistent item_id values. Variable transformations (variable settings → Format Value) run regex replace, lowercase, substring, and JSON operations on variable output before tags consume them. Clean data in GTM instead of patching every theme template.
Scenario on a real storefront
Product pages push item_id as SKU-12345-US on the US site and sku_12345_us on the UK mirror. You normalize in a Data Layer Variable before GA4 tags fire:
Variable: DLV - item_id (raw)
Format Value → Transformations:
1. Regex replace: ^[Ss][Kk][Uu][-_]? → (empty)
2. Regex replace: -[A-Z]{2}$ → (empty) // drop -US suffix
3. Lowercase
GA4 Event tag view_item:
items.0.item_id = {{DLV - item_id (normalized)}}
// Alternative: Table lookup for legacy SKU → canonical ID map
What to do next
- Apply transformations on variables, not inside every tag - one place to update when merchandising changes SKU rules.
- Document regex rules in the workspace description; opaque transforms confuse the next analyst.
- Use Preview Variables tab on a product URL before wiring purchase items - confirm output matches your ERP.
Bottom line
Transformations keep GA4 item parameters comparable when the catalog is messy. Centralize cleanup in variables so tags stay simple and revenue-by-SKU reports stay trustworthy.