Does Order Matter When I'm Adding Custom Scripts to My Landing Page?

Follow

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.

script_manager_menu.png

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 
  • placement.png
  • What part of your landing page you’d like the script to be included on.include_menu.png

 

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

Variant Scripts are added to each individual landing page, rather than being applied globally across all the landing pages on your domain.

To access the Variant Scripts dialog box, click the Javascripts javascripts_button.png button at the bottom left corner of the screen and a new dialog box will appear.

javascripts_screenshot.png

You can add your script to the new dialog box, and choose the placement of the script in the Placement menu.

variant_script_dialog_box.png

 

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:

script_loading_diagram.png

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.