[{"data":1,"prerenderedAt":318},["ShallowReactive",2],{"rule-ga4-purchase-wrong-trigger":3},{"id":4,"title":5,"body":6,"breadcrumb":282,"coderail":289,"dateModified":307,"datePublished":307,"description":308,"extension":309,"meta":310,"navigation":311,"next":307,"path":312,"prev":307,"schemaType":313,"seo":314,"stem":315,"wide":316,"__hash__":317},"docs\u002Frules\u002Fga4-purchase-wrong-trigger.md","Purchase event on page-load trigger",{"type":7,"value":8,"toc":273},"minimark",[9,16,54,59,96,100,110,114,140,144,183,187,245,249],[10,11,12],"p",{},[13,14,15],"strong",{},"Summary",[17,18,19,30,36,42,48],"ul",{},[20,21,22,25,26],"li",{},[13,23,24],{},"rule_id"," — ",[27,28,29],"code",{},"ga4-purchase-wrong-trigger",[20,31,32,35],{},[13,33,34],{},"purpose"," — Detect GA4 purchase event tags firing on page-load or link-click triggers instead of a Custom Event trigger",[20,37,38,41],{},[13,39,40],{},"effect"," — Purchase events may fire before ecommerce data is pushed to the dataLayer, or fire on non-purchase pages",[20,43,44,47],{},[13,45,46],{},"layer"," — container",[20,49,50,53],{},[13,51,52],{},"reversibility"," — non-destructive",[55,56,58],"h2",{"id":57},"what-fires-this","What fires this",[10,60,61,62,65,66,69,70,73,74,77,78,77,81,77,84,87,88,91,92,95],{},"The rule inspects all GA4 event tags where ",[27,63,64],{},"eventName"," is ",[27,67,68],{},"purchase"," (case-insensitive). For each such tag it checks ",[27,71,72],{},"firingTriggerIds"," against a set of page-load trigger types: ",[27,75,76],{},"PAGEVIEW",", ",[27,79,80],{},"DOM_READY",[27,82,83],{},"WINDOW_LOADED",[27,85,86],{},"LINK_CLICK",", and ",[27,89,90],{},"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 ",[27,93,94],{},"getGA4EventTags"," filters them upstream.",[55,97,99],{"id":98},"why-it-matters","Why it matters",[10,101,102,103,106,107,109],{},"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 ",[27,104,105],{},"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 ",[27,108,68],{}," that fires only after the ecommerce object is populated.",[55,111,113],{"id":112},"example","Before \u002F after",[115,116,117,131],"compare",{},[118,119,121],"compare-col",{"label":120},"Before — flagged",[122,123,129],"pre",{"className":124,"code":126,"language":127,"meta":128},[125],"language-text","Tag: \"GA4 - Purchase\"\n  Event name: purchase\n  Firing trigger: \"All Pages\" (type: PAGEVIEW)\n\nTag fires on every page load.\nEcommerce data not yet in dataLayer.\n","text","",[27,130,126],{"__ignoreMap":128},[118,132,134],{"label":133},"After — fixed",[122,135,138],{"className":136,"code":137,"language":127,"meta":128},[125],"Tag: \"GA4 - Purchase\"\n  Event name: purchase\n  Firing trigger: \"CE - purchase\" (type: CUSTOM_EVENT)\n    Event name matches: purchase\n\nTag fires only when dataLayer.push({ event: 'purchase', ecommerce: {...} })\nis called, ensuring transaction data is present.\n",[27,139,137],{"__ignoreMap":128},[55,141,143],{"id":142},"remediation","Remediation",[145,146,147,150,158,164,167,174,180],"ol",{},[20,148,149],{},"Open GTM and identify each purchase tag listed in the rule output.",[20,151,152,153,77,155,157],{},"Check the current firing trigger and note its type (",[27,154,76],{},[27,156,80],{},", etc.).",[20,159,160,161,163],{},"Create a Custom Event trigger with event name ",[27,162,68],{}," if one does not exist.",[20,165,166],{},"Replace the page-load trigger on the purchase tag with the Custom Event trigger.",[20,168,169,170,173],{},"Confirm the site's dataLayer implementation pushes ",[27,171,172],{},"{ event: 'purchase', ecommerce: { ... } }"," on transaction completion.",[20,175,176,177,179],{},"Preview the container, complete a test purchase, and verify the purchase tag fires exactly once with a populated ",[27,178,105],{}," object.",[20,181,182],{},"Publish the container.",[55,184,186],{"id":185},"metadata","Metadata",[188,189,192,193,198,192,202,206,192,209,213,192,216,219,192,222,226,192,229,233,192,239,242],"dl",{"className":190},[191],"spec-list","\n  ",[194,195,197],"dt",{"id":196},"severity","Severity",[199,200,201],"dd",{},"high",[194,203,205],{"id":204},"tier","Tier",[199,207,208],{},"optimization",[194,210,212],{"id":211},"category","Category",[199,214,215],{},"ga4",[194,217,218],{"id":46},"Layer",[199,220,221],{},"container",[194,223,225],{"id":224},"version","Version",[199,227,228],{},"1",[194,230,232],{"id":231},"effort","Effort",[199,234,235,238],{},[27,236,237],{},"15min"," (about 15 minutes)",[194,240,241],{"id":52},"Reversibility",[199,243,244],{},"non-destructive",[55,246,248],{"id":247},"see-also","See also",[17,250,251,259,266],{},[20,252,253,258],{},[254,255,257],"a",{"href":256},"\u002Fcategories\u002Fga4\u002F","GA4 rules"," — other rules in this category",[20,260,261,265],{},[254,262,264],{"href":263},"\u002Fhealth-score\u002F","Health score"," — how this rule contributes to the score",[20,267,268,272],{},[254,269,271],{"href":270},"\u002Frules\u002F","Rules catalog"," — browse all rules",{"title":128,"searchDepth":274,"depth":274,"links":275},2,[276,277,278,279,280,281],{"id":57,"depth":274,"text":58},{"id":98,"depth":274,"text":99},{"id":112,"depth":274,"text":113},{"id":142,"depth":274,"text":143},{"id":185,"depth":274,"text":186},{"id":247,"depth":274,"text":248},[283,286,288],{"label":284,"href":285},"API Reference","\u002F",{"label":287,"href":270},"Rules",{"label":29},{"cards":290,"onpage":301},[291],{"title":292,"tabs":293},"Evaluate",[294,298],{"label":295,"language":296,"code":297},"cURL","bash","curl https:\u002F\u002Fdeveloper.tagmanifest.com\u002Fv1\u002Fevaluate-rule \\\n  -H \"Authorization: Bearer $TM_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"rule_id\":\"ga4-purchase-wrong-trigger\",\"url\":\"https:\u002F\u002Fexample.com\"}'\n",{"label":299,"language":127,"code":300},"MCP","User: Run ga4-purchase-wrong-trigger on https:\u002F\u002Fexample.com\n\n# Tool call\n{\n  \"tool\": \"evaluate_rule\",\n  \"arguments\": {\n    \"rule_id\": \"ga4-purchase-wrong-trigger\",\n    \"url\": \"https:\u002F\u002Fexample.com\"\n  }\n}\n",[302,303,304,305,306],{"id":57,"label":58},{"id":98,"label":99},{"id":112,"label":113},{"id":142,"label":143},{"id":185,"label":186},null,"Purchase event triggered by page-load instead of a custom event trigger, which may fire before ecommerce data is ready.","md",{},true,"\u002Frules\u002Fga4-purchase-wrong-trigger","TechArticle",{"title":5,"description":308},"rules\u002Fga4-purchase-wrong-trigger",false,"cUTg4cf6xfWDyIkJWaprhsU3C-6DwykOv5lPedios0w",1796069483934]