Browse by Topic

Adding Custom Scripts to Stencil Themes

Many third-party applications and services rely on the ability to inject custom scripts into a website’s footer in order to function. Most apps will automatically inject these scripts in the correct location. On some occasions, it may require copying and pasting the script. 

Using the Script Manager

The Script Manager records injected code or scripts from apps. This makes organizing your installed scripts convenient to view and edit individually. To access the Script Manager, go to Storefront › Script Manager. If you need to copy a script, click the Create a Script button, give it a name, select a location and select the Script Type Script to paste the script a box. See Using Script Manager for more details.

Script Manager

 

Can I add custom HTML code outside of my site’s footer? It is possible to paste code in other template files using Edit Theme Files. Keep in mind that the script may not be compatible with the Stencil framework. For further assistance check out our BigCommerce Partner Directory or ask your question in the BigCommerce Community Ask a Design Partner Group.

Handlebars in Stencil Footer

In addition to HTML and custom scripts, you can paste the templating language Handlebars into the footer of Stencil themes via Edit Theme Files. This allows for more robust customizations.

Handlebars is a templating language used to develop and customize Stencil themes. For example, you can use Handlebars to reference theme-wide variables like your store’s name or logo. Third-party apps could use Handlebars to reference customer information, in order to display loyalty offers specific to the person logged in.

To learn more about using Handlebars in Stencil themes, see our developer documentation on Developing with Handlebars.

Analytics and Conversion Tracking Scripts

Analytics and conversion tracking scripts are usually added to the header or checkout. The following articles detail how to add these scripts to your store.

Go to Script Manager in my store

Was this article helpful?