Adding Your Custom Scripts Using Script Manager

Follow

Note

If you're concerned with GDPR compliance, ensure that any third-party forms or code involving heat-mapping or tracking are not interacting with your leads.

What is Script Manager?

Script Manager allows you to apply scripts to all of the pages in a custom domain (or multiple domains) via a single process. If you have scripts (like Google Analytics) that you need to apply to many pages, Script Manager is designed to make your life a lot easier.

Please note that this feature requires your own custom domain. You cannot use this feature with the test domain 'unbouncepages.com.'

 

Adding Scripts 

Note:

If you have pages under a domain that already contains the script you wish to add, this can cause the code to execute twice. Be sure to remove the page-level script before adding it on a domain level to avoid any conflicts.

Note:

Global scripts added into the script manager will load after scripts added in your landing page variants.

To add a script:

  1. Click on Settings in the left menu. A new drop-down menu will appear.
  2. Select Script Manager.
  3. Click the Add a Script button at the top right of the screen. A dialog box will appear. script_manager_add_a_script.png
  4. In the new Add a Script dialog box, Enter a name for your script and click the Add Script Details button.
  5. Use the Placement drop-down menu to choose the placement of your script.script_manager_placement.png
  6. Use the Included on drop-down menu to choose whether you want your script added to your main pages, confirmation dialog pages, or both.script_manager_included_on.png
  7. Paste or type your script in the editor window. 
  8. Choose the domain(s) that you would like to add your script to via the checkboxes on the right.script_manager_select_domain.png
  9. Click the Save Changes button near the bottom left of the screen.

Your script will be applied to all pages for the chosen domain and will be applied automatically to all new pages published to the same domain as well.

Once your scripts in Script Manager is enabled, you may also view them in the Javascripts section in the page builder.

 

Disabling, Deleting, and Editing Scripts

Disable (or re-enable) or delete a script via the cog script_manager_cog_menu.png menu for each script.script_manager_disable_delete.png

Enter the edit screen for any script by clicking anywhere else on the grey bar for each script.

 

Migrating Scripts to Script Manager

When adding a script to Script Manager, it's generally important to make sure that the script isn't already on any of your pages. Otherwise, when you add it to Script Manager it could end up being run twice. For tracking scripts like Google Analytics or Google Ads Conversion Tracking, this will result in multiple pageviews or conversions, and inaccurate data.

The best way to avoid this is to go through each page and remove the script from the page, before adding it to Script Manager.

This is a one-time process similar to the Google Tag Manager's migration process.

If you are concerned about not tracking pageviews or conversions in the time period between removing the script from a page and re-adding it to Script Manager, we'd recommend deleting the script on all your pages, but not republishing them yet. Then, once the script is gone from all your pages, you can add the script to Script Manager and then go through and quickly republish the pages, which should cut down this period of time significantly.

 

Script Manager - Advanced Tips and Tricks

Using Page-Level Variables

There are some page-level variables that Script Manager scripts can make use of.

window.ub.page.id  – Unbounce's internal ID for your page. IDs are unique to each page, so they could be useful to differentiate between pages – e.g. "a07b7610-6a9e-11e4-b67a-22000b6882a2"

window.ub.page.variantId  – the ID letter of the current variant – e.g. "a"

window.ub.page.name  – the name you have given the page inside Unbounce – e.g. "My Page Name"

You could use these to have your script behave differently on different pages, or variants. For example, you could send the variantId as a custom variable to your analytics platform.

 

Other Articles You May Find Useful:

Integrating with Google Analytics using Script Manager

 How do I Integrate Google Tag Manager with Unbounce?

 

Using Custom CSS and Javascript on Your Landing Page

How Do I Embed Custom HTML or Widgets Into a Landing Page? 

Was this article helpful?
0 out of 0 found this helpful