No items found.
![](https://cdn.prod.website-files.com/63db712d6ca3be3a94b3d4a0/63f7e99c945daba0cb121cbe_20230223T1030-5e01de1f-9eac-4921-a356-ce2c3fa0786b.jpeg)
Summary
Sometimes you need to add JavaScript to a single or a group of pages in Shopify either for tracking or to add a certain behavior.
To add JavaScript to an individual or group of Shopify pages:
- Go to your Shopify Admin and go to Online Store
- Click Actions > Edit Code
- Under your Templates folder, select Add a new template
- Choose the type of page you want the JavaScript to be added to. I will choose page as an example.
- Click Create template
- At the bottom of this file, include your JavaScript. Be sure to wrap it in <script></script> tags. I added a simple alert.
- Go to Page and Add or edit a page.
- In the page editor on the right-hand side, select the new template you just created.
- Test your page out! The JavaScript you wrote should be working.
- If you want this to apply to multiple pages, change the templates of the other pages you want the JavaScript to run on.
![](https://cdn.prod.website-files.com/63db712d6ca3be3a94b3d4a0/63e7e31ff1730595a0f59e27_60b912b63c38de8840c0f12b_image-76-1024x598.png)
![](https://cdn.prod.website-files.com/63db712d6ca3be3a94b3d4a0/63e7e31ff17305fb59f59e29_60b912b69de8813adb58fb12_image-77-1024x619.png)
![](https://cdn.prod.website-files.com/63db712d6ca3be3a94b3d4a0/63e7e31ff17305f241f59e2b_60b912b6a608f9d71287800d_image-78-1024x482.png)
![](https://cdn.prod.website-files.com/63db712d6ca3be3a94b3d4a0/63e7e31ff1730536e5f59e28_60ba5cf5f9b7546eb4b029f5_image-79-1024x622.png)
![](https://cdn.prod.website-files.com/63db712d6ca3be3a94b3d4a0/63e7e31ff1730527e3f59e2a_60b912b69dd7ad147fd8694f_image-80-1024x330.png)
Start your affiliate program today
Grow your Shopify store without an upfront cost.