[{"data":1,"prerenderedAt":378},["ShallowReactive",2],{"rule-all-pages-url-specific":3},{"id":4,"title":5,"body":6,"breadcrumb":343,"coderail":350,"dateModified":368,"datePublished":368,"description":369,"extension":370,"meta":371,"navigation":172,"next":368,"path":372,"prev":368,"schemaType":373,"seo":374,"stem":375,"wide":376,"__hash__":377},"docs\u002Frules\u002Fall-pages-url-specific.md","All Pages trigger with URL-specific code",{"type":7,"value":8,"toc":335},"minimark",[9,16,54,59,88,92,99,103,209,213,241,245,303,307,331],[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",{},"all-pages-url-specific",[20,31,32,35],{},[13,33,34],{},"purpose"," — Detect Custom HTML tags that fire on All Pages but contain URL-checking logic in their code",[20,37,38,41],{},[13,39,40],{},"effect"," — Tag loads and executes on every page view, even pages where it immediately exits",[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,73,77,73,80,83,84,87],{},"The rule inspects active Custom HTML tags whose ",[27,63,64],{},"firingTriggerIds"," includes the All Pages built-in trigger ID (",[27,67,68],{},"2147479553","). It then tests the tag code against a pattern matching ",[27,71,72],{},"location.href",", ",[27,75,76],{},"location.pathname",[27,78,79],{},"window.location",[27,81,82],{},"document.URL",", or ",[27,85,86],{},"hostname",". A tag must match both conditions to be flagged. Paused tags are excluded. This rule is suppressed on public-endpoint scans because Google's compilation step transforms the All Pages trigger ID — it fires reliably only against JSON container exports.",[55,89,91],{"id":90},"why-it-matters","Why it matters",[10,93,94,95,98],{},"GTM loads and executes the full tag on every page before the tag's own URL check runs. On a site with 20 pages, a tag intended for one URL fires 19 times needlessly. Moving the URL condition into a GTM trigger filter prevents the tag from loading at all on irrelevant pages. The performance cost scales with tag weight — large Custom HTML tags with third-party script calls waste the most. The pattern is common in legacy containers where inline ",[27,96,97],{},"if"," statements replaced proper trigger configuration.",[55,100,102],{"id":101},"example","Before \u002F after",[104,105,106,198],"compare",{},[107,108,110],"compare-col",{"label":109},"Before — flagged",[111,112,117],"pre",{"className":113,"code":114,"language":115,"meta":116,"style":116},"language-js shiki shiki-themes github-light github-dark","\u002F\u002F Tag fires on All Pages trigger\n\u002F\u002F URL gate lives inside the tag code\nif (!location.pathname.startsWith('\u002Fcheckout\u002F')) return\n\n\u002F\u002F checkout-specific tracking code below\ndataLayer.push({ event: 'checkout_view' })\n","js","",[27,118,119,128,134,167,174,180],{"__ignoreMap":116},[120,121,124],"span",{"class":122,"line":123},"line",1,[120,125,127],{"class":126},"sJ8bj","\u002F\u002F Tag fires on All Pages trigger\n",[120,129,131],{"class":122,"line":130},2,[120,132,133],{"class":126},"\u002F\u002F URL gate lives inside the tag code\n",[120,135,137,140,144,147,150,154,157,161,164],{"class":122,"line":136},3,[120,138,97],{"class":139},"szBVR",[120,141,143],{"class":142},"sVt8B"," (",[120,145,146],{"class":139},"!",[120,148,149],{"class":142},"location.pathname.",[120,151,153],{"class":152},"sScJk","startsWith",[120,155,156],{"class":142},"(",[120,158,160],{"class":159},"sZZnC","'\u002Fcheckout\u002F'",[120,162,163],{"class":142},")) ",[120,165,166],{"class":139},"return\n",[120,168,170],{"class":122,"line":169},4,[120,171,173],{"emptyLinePlaceholder":172},true,"\n",[120,175,177],{"class":122,"line":176},5,[120,178,179],{"class":126},"\u002F\u002F checkout-specific tracking code below\n",[120,181,183,186,189,192,195],{"class":122,"line":182},6,[120,184,185],{"class":142},"dataLayer.",[120,187,188],{"class":152},"push",[120,190,191],{"class":142},"({ event: ",[120,193,194],{"class":159},"'checkout_view'",[120,196,197],{"class":142}," })\n",[107,199,201],{"label":200},"After — fixed",[111,202,207],{"className":203,"code":205,"language":206,"meta":116},[204],"language-text","Trigger type: Page View — Some Pages\nCondition: Page Path starts with \u002Fcheckout\n\nTag code (no URL check needed):\ndataLayer.push({ event: 'checkout_view' })\n","text",[27,208,205],{"__ignoreMap":116},[55,210,212],{"id":211},"remediation","Remediation",[214,215,216,219,226,229,232,235,238],"ol",{},[20,217,218],{},"Open the flagged Custom HTML tag in GTM.",[20,220,221,222,225],{},"Identify the URL pattern in the JavaScript (e.g., ",[27,223,224],{},"location.pathname.startsWith('\u002Fcheckout\u002F')",").",[20,227,228],{},"Create a Page View — Some Pages trigger with a filter matching that URL pattern.",[20,230,231],{},"Remove the All Pages trigger from the tag and assign the new URL-specific trigger.",[20,233,234],{},"Delete the URL-checking code from the tag body — the trigger now handles that condition.",[20,236,237],{},"Preview in GTM debug mode and confirm the tag fires only on the intended pages.",[20,239,240],{},"Publish the container.",[55,242,244],{"id":243},"metadata","Metadata",[246,247,250,251,256,250,260,264,250,267,271,250,274,277,250,280,284,250,287,291,250,297,300],"dl",{"className":248},[249],"spec-list","\n  ",[252,253,255],"dt",{"id":254},"severity","Severity",[257,258,259],"dd",{},"medium",[252,261,263],{"id":262},"tier","Tier",[257,265,266],{},"optimization",[252,268,270],{"id":269},"category","Category",[257,272,273],{},"performance",[252,275,276],{"id":46},"Layer",[257,278,279],{},"container",[252,281,283],{"id":282},"version","Version",[257,285,286],{},"1",[252,288,290],{"id":289},"effort","Effort",[257,292,293,296],{},[27,294,295],{},"2hr"," (about 2 hours)",[252,298,299],{"id":52},"Reversibility",[257,301,302],{},"non-destructive",[55,304,306],{"id":305},"see-also","See also",[17,308,309,317,324],{},[20,310,311,316],{},[312,313,315],"a",{"href":314},"\u002Fcategories\u002Fperformance\u002F","Performance rules"," — other rules in this category",[20,318,319,323],{},[312,320,322],{"href":321},"\u002Fhealth-score\u002F","Health score"," — how this rule contributes to the score",[20,325,326,330],{},[312,327,329],{"href":328},"\u002Frules\u002F","Rules catalog"," — browse all rules",[332,333,334],"style",{},"html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":116,"searchDepth":130,"depth":130,"links":336},[337,338,339,340,341,342],{"id":57,"depth":130,"text":58},{"id":90,"depth":130,"text":91},{"id":101,"depth":130,"text":102},{"id":211,"depth":130,"text":212},{"id":243,"depth":130,"text":244},{"id":305,"depth":130,"text":306},[344,347,349],{"label":345,"href":346},"API Reference","\u002F",{"label":348,"href":328},"Rules",{"label":29},{"cards":351,"onpage":362},[352],{"title":353,"tabs":354},"Evaluate",[355,359],{"label":356,"language":357,"code":358},"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\":\"all-pages-url-specific\",\"url\":\"https:\u002F\u002Fexample.com\"}'\n",{"label":360,"language":206,"code":361},"MCP","User: Run all-pages-url-specific on https:\u002F\u002Fexample.com\n\n# Tool call\n{\n  \"tool\": \"evaluate_rule\",\n  \"arguments\": {\n    \"rule_id\": \"all-pages-url-specific\",\n    \"url\": \"https:\u002F\u002Fexample.com\"\n  }\n}\n",[363,364,365,366,367],{"id":57,"label":58},{"id":90,"label":91},{"id":101,"label":102},{"id":211,"label":212},{"id":243,"label":244},null,"Tags fire on every page but contain URL-checking logic. This means the tag loads, parses, and executes on every page just to check if it should run. Use a targeted trigger instead.","md",{},"\u002Frules\u002Fall-pages-url-specific","TechArticle",{"title":5,"description":369},"rules\u002Fall-pages-url-specific",false,"F2eiSGLkQkuUXnfJVZPjtbv4KKykAZVDlthvMi233hg",1796069484135]