When adding scripts to your landing page, order can matter, especially when you’re setting up Google Tag Manager to track custom events, for example on a main landing page and on a form confirmation page.
When you add custom scripts to Unbounce, you can add them in two different places:
- Script Manager/Global Scripts
- Variant Scripts
Script Manager/Global Scripts
Global scripts are added through the Script Manager menu link under Settings on the left side of the page.
Adding scripts through Script Manager allows you to access that same script across all of your domains and landing pages.
Custom Scripts added through Script Manager gives you options regarding:
- Placement of your script, and
- What part of your landing page you’d like the script to be included on.
Note:Google Analytics scripts added through Script Manager are automatically added to the Head. Google Tag Manager scripts added through Script Manager are automatically added to the After Body Tag. Both are included in all parts of your landing page.
Variant Scripts are added to each individual landing page, rather than being applied globally across all the landing pages on your domain.
You can add your script to the new dialog box, and choose the placement of the script in the Placement menu.
How Does this Affect the Way My Custom Scripts Load on My Landing Page?
The diagram below illustrates how Unbounce loads scripts for your pages, in order from top to bottom. Unbounce pages load scripts in the order you add them, within their respective placements:
If you're finding you're having issues with a specific script not firing properly, it may be due to the order in which you’ve added your script to your landing page.
If you have any issues, please contact the Unbounce Support Team by clicking the Support menu at the top right corner of the Unbounce Builder.