Website Building » Shopify » How Do I Use Script Tags in Shopify?

How Do I Use Script Tags in Shopify?

Last updated on January 13, 2023 @ 3:42 am

The script tag is an HTML element that allows you to embed or reference a JavaScript file on your web page. This element is most commonly used to embed or include external JavaScript files.

The script> tag has two primary attributes: src and type. The src attribute is used to specify the URL of the JavaScript file to be included. The type attribute is used to specify the type of script, such as text/javascript.

Including a JavaScript file using the script> tag is simple. You just need to use the src attribute to specify the URL of the JavaScript file. For example, if you wanted to include a file called “script.js” from your “js” directory, you would use the following code:

PRO TIP: If you are not comfortable working with code, we recommend finding a Shopify Expert to help you with this. Making even a small mistake in the code could break your whole store.

You can also use the script> tag to inline your own JavaScript code. Inlining your code can be useful if you want to execute a script immediately after the page has loaded. To do this, you would use the following code:


Madison Geldart

Madison Geldart

Cloud infrastructure engineer and tech mess solver.