Purchase event on page-load trigger
Purchase event triggered by page-load instead of a custom event trigger, which may fire before ecommerce data is ready.
Summary
- rule_id —
ga4-purchase-wrong-trigger - purpose — Detect GA4 purchase event tags firing on page-load or link-click triggers instead of a Custom Event trigger
- effect — Purchase events may fire before ecommerce data is pushed to the dataLayer, or fire on non-purchase pages
- layer — container
- reversibility — non-destructive
What fires this
The rule inspects all GA4 event tags where eventName is purchase (case-insensitive). For each such tag it checks firingTriggerIds against a set of page-load trigger types: PAGEVIEW, DOM_READY, WINDOW_LOADED, LINK_CLICK, and JUST_LINKS. GTM's built-in page-load triggers (All Pages, Initialization, Consent Initialization) count as page-load triggers too. If any purchase tag resolves to one of those trigger types, the tag is flagged. The rule returns one issue per container listing all affected tags and their matched trigger names. Paused tags are excluded because getGA4EventTags filters them upstream.
Why it matters
A purchase event must fire after transaction data lands in the dataLayer. Page-load triggers run before any ecommerce payload is available. The result is a purchase hit with empty or null ecommerce fields, which GA4 records as a conversion with no revenue. On sites with shared confirmation-page templates, the tag can also fire on non-purchase pages that reuse the same URL pattern. Both scenarios corrupt conversion and revenue data in ways that are not always visible in real-time reports. The correct pattern is a Custom Event trigger bound to a dataLayer event like purchase that fires only after the ecommerce object is populated.
Before / after
Tag: "GA4 - Purchase"
Event name: purchase
Firing trigger: "All Pages" (type: PAGEVIEW)
Tag fires on every page load.
Ecommerce data not yet in dataLayer.
Tag: "GA4 - Purchase"
Event name: purchase
Firing trigger: "CE - purchase" (type: CUSTOM_EVENT)
Event name matches: purchase
Tag fires only when dataLayer.push({ event: 'purchase', ecommerce: {...} })
is called, ensuring transaction data is present.
Remediation
- Open GTM and identify each purchase tag listed in the rule output.
- Check the current firing trigger and note its type (
PAGEVIEW,DOM_READY, etc.). - Create a Custom Event trigger with event name
purchaseif one does not exist. - Replace the page-load trigger on the purchase tag with the Custom Event trigger.
- Confirm the site's dataLayer implementation pushes
{ event: 'purchase', ecommerce: { ... } }on transaction completion. - Preview the container, complete a test purchase, and verify the purchase tag fires exactly once with a populated
ecommerceobject. - Publish the container.
Metadata
- Severity
- high
- Tier
- optimization
- Category
- ga4
- Layer
- container
- Version
- 1
- Effort
15min(about 15 minutes)- Reversibility
- non-destructive
See also
- GA4 rules — other rules in this category
- Health score — how this rule contributes to the score
- Rules catalog — browse all rules
Examples
curl https://developer.tagmanifest.com/v1/evaluate-rule \
-H "Authorization: Bearer $TM_API_KEY" \
-H "Content-Type: application/json" \
-d '{"rule_id":"ga4-purchase-wrong-trigger","url":"https://example.com"}'
User: Run ga4-purchase-wrong-trigger on https://example.com
# Tool call
{
"tool": "evaluate_rule",
"arguments": {
"rule_id": "ga4-purchase-wrong-trigger",
"url": "https://example.com"
}
}