Toggle this on to add custom JavaScript that runs on the pre-checkout page.
This feature is intended for developers.
How Scripts Work
Your script is injected at the bottom of the page's HTML (before </body>) on initial load. It runs once when the checkout page loads, and has full access to the page DOM. This means you can add tracking pixels, inject styles, or manipulate page elements just like any script on a regular web page.
Use Cases
Custom event tracking
Third-party analytics
Custom CSS styling (see Pre-Checkout Page > Custom CSS for class names and examples)
Scripts run in the context of the pre-checkout page and have access to the page DOM.
Example: Google Analytics
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config','G-XXXXXXXXXX');
</script>
Replace G-XXXXXXXXXX with your Google Analytics measurement ID.
