Adding custom JavaScript to your online store can improve functionality, add widgets, and integrate analytics. This guide explains how to add custom JavaScript code to your store with Custom Scripts.
Open Custom Scripts
Go to your Storelink dashboard and click on Settings > Integrations. Click on the gear icon on the Custom script card.

Add a new script
The Custom Scripts window lists all the scripts in your store on the left. Click on + Add script to create a new one. Keeping each piece of code in its own script makes it easier to find, turn off or remove later.

Add your JavaScript
Give your script a Name so you can recognize it later. Use Page to choose where the code runs: All Pages, Home, Category, Product, or Cart & Checkout. For example, a chat widget usually runs on All Pages, while a checkout tracking script only needs Cart & Checkout. Make sure the script is Enabled.
Then paste your code in the code box, inside <script> tags. For example:
<script>
// Show a message in the browser console when the page loads
window.addEventListener("load", function () {
console.log("Welcome to our store!");
});
</script>Click on Save when you're finished.

Tip
You can click on Ask AI in the code box and describe what you want the code to do. Always test your store after adding a script.
To change or remove a script later, open Custom Scripts again and select it on the left. Turn off Enabled to pause it, or click on Delete to remove it.
If you need to take actions or track specific store events, you can listen to events. See How to take actions based on store event? for more details.
Still need help?
Contact us