Skip to content
  • There are no suggestions because the search field is empty.

Datalayer requirements for ProfitMetrics client-side Google Tag Manager integration

The ProfitMetrics client-side GTM tag reads purchase data from your dataLayer to send order information to ProfitMetrics. This article explains exactly which fields are required, which are optional, and how the tag detects your dataLayer format.

DataLayer Requirements for Client-Side GTM Integration

 

Supported DataLayer Formats

The tag auto-detects your dataLayer format by checking for these structures in order:

  1. GA Enhanced Ecommerce (UA)ecommerce.purchase.actionField
  2. GA4 Ecommerceecommerce.transaction_id
  3. GA4 via eventModeleventModel.transaction_id
  4. LegacytransactionId
  5. Custom — Fields mapped manually in the GTM tag configuration

You can also force a specific format using the "Select dataLayer type for quick set up" dropdown, or choose Custom to map each field individually using GTM variables.


Required Fields

These fields must be present in your dataLayer for the tag to function correctly. The exact field paths depend on your dataLayer format.

GA4 Ecommerce (ecommerce.transaction_id)

Field DataLayer Path
Transaction ID ecommerce.transaction_id
Revenue ecommerce.value
Tax ecommerce.tax
Shipping ecommerce.shipping
Currency ecommerce.currency
Products ecommerce.items

UA Enhanced Ecommerce (ecommerce.purchase.actionField)

Field DataLayer Path
Transaction ID ecommerce.purchase.actionField.id
Revenue ecommerce.purchase.actionField.revenue
Tax ecommerce.purchase.actionField.tax
Shipping ecommerce.purchase.actionField.shipping
Currency ecommerce.currencyCode
Coupon Code ecommerce.purchase.actionField.coupon
Products ecommerce.purchase.products

GA4 via eventModel (eventModel.transaction_id)

Field DataLayer Path
Transaction ID eventModel.transaction_id
Revenue eventModel.value
Tax eventModel.tax
Shipping eventModel.shipping
Currency eventModel.currency
Products eventModel.items

Legacy (transactionId)

Field DataLayer Path
Transaction ID transactionId
Revenue transactionTotal
Tax transactionTax
Shipping transactionShipping
Products transactionProducts

Note: Currency and Coupon Code are not supported in the Legacy format.


Product Array

Each item in the products array must include:

Field Accepted Keys Required?
Product ID id, sku, item_id, or itemId ✅ Yes
Quantity quantity or qty ✅ Yes
Price price or priceExVat ✅ Yes

Note on price: If your product prices include tax, enable the "Products include tax" setting in the GTM tag. The tag will automatically calculate the ex-VAT price using the derived tax rate.

Example (GA4 format)

 
 
json
{
"event": "purchase",
"ecommerce": {
"transaction_id": "ORD-12345",
"value": 150.00,
"tax": 30.00,
"shipping": 10.00,
"currency": "EUR",
"coupon": "SUMMER20",
"items": [
{
"item_id": "SKU-001",
"quantity": 2,
"price": 50.00
},
{
"item_id": "SKU-002",
"quantity": 1,
"price": 20.00
}
]
}
}

Optional Fields

These fields improve attribution accuracy and enable additional ProfitMetrics features. They are configured directly in the GTM tag settings (not read from the dataLayer automatically).

Tag Field Description
Email Customer email — used for cross-device matching and Conversion Booster
Phone Customer phone number (digits are extracted automatically)
Payment Method e.g. "Credit Card", "PayPal"
Shipping Method e.g. "Free shipping", "Express"
Shipping Country Country code or name, e.g. "US"
Shipping Zipcode Postal/zip code
Shipping Weight Numeric weight of the shipment

Tax & Revenue Settings

The tag needs to understand how your platform reports tax, revenue, and shipping in order to calculate accurate ex-VAT and incl-VAT totals. Configure these in the Tax settings section:

Tag Setting What it means
Does Revenue Include Tax? The revenue / value field already has tax added
Does Revenue Include Shipping? The revenue / value field already has shipping added
Does Shipping Include Tax? The shipping field includes tax
Does Products Include Tax? Product price values include tax
Does Tax Include Shipping Tax? The tax field includes the tax portion of shipping
VAT/Tax rate override Manually set a fixed tax rate instead of the auto-calculated one

If these settings are incorrect, ProfitMetrics will calculate incorrect profit margins. If you are unsure, check a sample order against your platform admin to verify.


Custom Field Overrides

The Custom fields (Override) section in the tag lets you override any of the core order fields. This is useful when your dataLayer doesn't match any of the standard formats, or when you need to pull a value from a GTM variable.

Override fields available: Transaction id, Revenue, Tax, Shipping, Currency, Coupon Code, Products (Array).

When a custom field is populated, it takes priority over the auto-detected dataLayer value.


Consent Handling

The tag reads consent state from the window.profitMetrics object, which is set by the ProfitMetrics 'All pages' GTM tag template:

  • profitMetrics.cookieStatisticsConsent — Controls whether GA cookies (_ga, _ga_*, pmGacid, pmVisitSource) are read
  • profitMetrics.cookieMarketingConsent — Controls whether marketing cookies (pmGclid, pmGbraid, pmWbraid, _fbp, _fbc) are read

If consent is not granted, the tag still sends the order data but without cookie-based attribution parameters. No cookies are read without the corresponding consent.


Troubleshooting

Enable Debug Mode in the tag settings to log detailed output to the browser console. This will show you exactly which dataLayer format was detected, what values were read, and the full URL being sent to ProfitMetrics.