Script Manager
  • 01 Mar 2024
  • 4 Minutes to read
  • Dark
    Light
  • PDF

Script Manager

  • Dark
    Light
  • PDF

Article summary

The Script Manager is a visual organization of scripts installed on your store. Any scripts applied by apps or created within the Script Manager are conveniently listed for easier management and access. This can help store owners see which scripts are installed on their site without searching through several lines of code. This feature is only available to stores using Stencil themes.

To access the Script Manager, go to Ecommerce Settings > Channel Manager > Elipses to the right of the Channel Domain > Edit Settings > Script Manager.

Are they using Multi-Storefront? Script Manager and other storefront-specific settings can be found within Channel Manager. See Single-Storefront vs. Multi-Storefront for more information.

Script Types

Any scripts listed in the Script Manager will have several labels in the overview, such as the script's name, the date of installation, the location of the script in the storefront, header or footer, and whether a third-party app installed the script or was manually entered into the Script Manager.

Script View

  • 3rd party — scripts created by apps are read-only. They can be viewed only.
  • User-created — scripts are manually entered into the Script Manager. These scripts can be edited and deleted.

Adding and Editing Scripts

IMPORTANT NOTE: This is an advanced feature that requires knowledge of scripting.

To add a script to your storefront, click Create a Script. Configure your script using the following information fields.

Create Script

  • Script name — Enter an internal name for reference. This field is required.
  • Description — State the script's purpose. This field is optional.
  • Placement — Select whether the script should be in the header or footer of the page.
  • Location— Select which pages the scripts will run on. You will have the following options:
    • Storefront pages: all pages, except for checkout or order confirmation pages
    • Checkout: checkout page (only works with Optimized One-Page Checkout)
    • Order Confirmation: order confirmation page
    • All pages: includes storefront, checkout, order confirmation, and cart page
  • Script category— Select a category that describes the purpose of the script. The storefront cookie consent banner uses this categorization. When enabled, the cookie consent banner allows shoppers to opt out of categories of cookies and scripts used by the store, which helps your store comply with privacy laws like GDPR and CCPA. See Security and Privacy Settings to learn more about your store's built-in customer privacy settings.
    • Essential: These scripts are essential for the site and any requested services to work, but they do not perform any additional or secondary function. Uncategorized scripts default to this category. Shoppers cannot opt out of essential scripts.
    • Analytics: These scripts provide statistical information on site usage, such as web analytics, leading to improvements over time.
    • Functional: These scripts enable enhanced functionality, such as videos and live chat. If you do not allow these, some or all functions may not work properly.
    • Targeting/Advertising: These scripts create profiles or personalize content to enhance your shopping experience.
  • Script Type — Select whether you are linking to a script by a URL or manually entering the script.
  • Load Method— Select the load method of the script.
    • Async — The script will be fetched in parallel to parsing and evaluated as soon as it's available.
    • Defer — The script will execute in the order it appears on the page.
    • Default — This setting will load the script according to the default attribute settings in browsers.

Once you finish this form, click Save to apply the script to your storefront. After creating a script, you can edit it by clicking the action icon and selecting Edit from the menu.

The Script Manager supports Handlebars. This allows you to access Stencil objects using scripts. To learn more about the Script API, see our Dev Center.

Deleting Scripts

You can remove both user-created and third-party scripts. Removing a third-party script before uninstalling the app is not recommended, as it can cause unexpected behavior.

Click the Action icon and select Delete to remove the script from your store. Alternatively, select View and click Delete. Click Delete again on the confirmation popup. 

Delete script from the action menu

FAQ

Can I place verification meta tags in the Script Manager?

Site verification HTML meta tags should be placed in the control panel's Site Verification Tags section. Go to SettingsData solutions, then click Connect next to Site Verification Tags under Web Analytics.

Can I still paste scripts in Footer Scripts?

Footer Scripts is the legacy script area for inserting scripts on Stencil themes. You can continue to use the Footer Scripts field, and any scripts already there will continue to work. However, the Script Manager allows for additional functionality and precision.

We recommend moving any existing scripts in the legacy Footer Scripts to Script Manager so they can be categorized and loaded based on your shoppers' cookie consent settings. See Security and Privacy Settings to learn more about your store's built-in customer privacy settings.

Why do I receive the error "This is not a valid script" when I enter my script into the Script Manager?

If you enter a script without the correct < script > tags, the Script Manager cannot accept the script, and you will receive this error.

What is the maximum script size?

Scripts must be 64KB (65,536 characters) or less.

How can I see if a script has been changed in the Script Manager?

A notification will appear in the control panel dashboard when a script is created, updated, or deleted in the Script Manager. The notification will indicate which script was changed and whether it was created, updated, or deleted.

Changes to Script Manager scripts appear in control panel notifications.

You can also see created, updated, and deleted script records in the Store Logs.

Why isn't the script I updated appearing on my storefront?

Scripts have a cache time of 20 seconds, so any scripts you have created, updated, or deleted may not appear on the storefront immediately.

Can I dismiss a Script Manager notification after viewing it?

Control panel notifications about Script Manager script changes cannot be dismissed for security purposes. The notification will remain in the control panel dashboard for 14 days, after which it will be automatically removed.


Was this article helpful?

What's Next