Browse by Topic

Using Script Manager

The BigCommerce 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 having to search through several lines of code. This feature is only available to stores using Stencil themes.

To access the Script Manager, go to Storefront › Script Manager.

 
 

Script Types

Any scripts listed in the Script Manager will have several labels in the overview, including the name, date of installation, the location of the script injection, pages affected, if a third-party app installed the script or if it was manually entered into the Script Manager.

Script View

  • 3rd party — app created scripts are read-only. They can be viewed only.
  • User-created — the script was manually entered into the Script Editor. The script can be edited and deleted.
 
 

Adding/Editing Scripts

To add a script, click Create a Script. This will open a screen with form fields to create the script.

 

Warning: This is an advanced feature that requires knowledge of scripting. If you are unfamiliar, please consider working with one of our partners.

  • Name of script — Enter a name for your script to refer to. This field is required.
  • Description — State the script’s purpose. This is optional.
  • Location on the page — Select whether the script should be in the header or footer of the page.
  • Select pages where script will be added — Select which page the scripts are on. You will have the following options:
    • Store pages: all pages that are not checkout or order confirmation
    • 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. This categorization is used by the storefront cookie consent banner. When enabled, the cookie consent banner allows shoppers to opt-out of categories of cookies/scripts used by the store, which helps your store to comply with privacy laws like GDPR and CCPA. See Store 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 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 so we can improve this website over time.
    • Functional: These scripts enable enhanced functionality, such as videos and live chat. If you do not allow these, then some or all of these functions may not work properly.
    • Targeting; Advertising: These scripts are used to create profiles or personalize content to enhance your shopping experience.
  • Script Type — Select whether you are linking to a script by an URL or manually entering in the script.
  • Load Method — Select the load method of the script.
    • Async — Classic scripts with the async attribute present will be fetched in parallel to parsing and evaluated as soon as it is available.
    • Defer — Scripts with the defer attribute will execute in the order in which they appear in the document.
    • Default — This setting will load scripts according to the default attribute your browser is set to.

Once you finish this form, click Save. After saving, you can edit scripts by clicking the action icon and click Edit from the menu.

 

Pro Tip! - The Script Manager supports Handlebars, allowing you access to Stencil objects using scripts. To learn more about the Script API, see our developer documentation.

 
 

Deleting Scripts

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

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

 
 

FAQ

Can I place verification meta tags in the Script Manager?

Site verification HTML meta tags should be placed into the Site Verification Tags tab of Web Analytics.

Can I still paste scripts in the Footer Scripts field?

The Footer Scripts field is the legacy script area to insert 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 Store 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 script without the correct < script > tags, the Script Manager cannot accept the script and you will receive this error.

Was this article helpful?