How do I apply scripts to every page at once?
You rarely want to paste the same code onto every page. The model is inheritance: whatever you set on the funnel applies to all of its pages, and the page only adds what is specific to it.
Before you start
- Role: Owner, Admin or Editor.
- For the Pixel and Google Tag Manager, do not use scripts: there are dedicated fields under Tracking. See end-to-end tracking.
Where each thing goes
Head Code or Footer Code?
- Head Code is inserted before
</head>. Use it for meta tags, fonts and global CSS. - Footer Code is inserted before
</body>. Use it for scripts in general — it is the default choice, because a script in the head delays the page from appearing.
Watch out for duplication
Funnel scripts are already applied automatically to every page. If you paste the same code onto the page as well, it runs twice — which usually shows up as a conversion counted twice.
Use the page's field only for what is exclusive to that page.
Publish for it to count
A script that is saved but not published never reaches the visitor. Once published, validate it by following validate pixel and events.
Page weight
Every external script delays loading. Before adding one more, see speed up my pages.
Related
If it didn't work
- The script does not run: confirm the page was published and test outside the preview.
- The event counts twice: the code is on both the funnel and the page at the same time.
- The page got slow after the script: move it to the Footer Code.