Skip to content

Add a Chat Widget or GTM to Your Storefront

Site-Wide Scripts vs Conversion Scripts

Cartly has two separate places for merchant scripts:

  • Settings → Custom Scripts — fires on every Liquid storefront page (home, product, collection, cart, blog, search, account). Use this for GTM, GA4 site-wide config, chat widgets, and session recording tools.
  • Preferences → Checkout / Order Status Scripts — fires only on the order confirmation page. Use this for purchase conversion events (Google Ads, Facebook Pixel). See Add Google Ads conversion tracking.

This article covers Settings → Custom Scripts.

Add Google Tag Manager

  1. In Google Tag Manager, click your container and go to Admin → Install Google Tag Manager.
  2. Copy the head snippet (the first block — paste it before </head>).
  3. Copy the body snippet (the second block — paste it after <body>).
  4. In your Cartly admin, go to Settings → Custom Scripts.
  5. Paste the head snippet into the Head Script field.
  6. Paste the body snippet into the Body Script field.
  7. Click Save.

GTM will load on every page of your storefront. You can then configure all your tags, triggers, and variables within GTM without touching Cartly settings again.

Add a Live Chat Widget

Live chat providers (Intercom, Crisp, Tidio, Zendesk, Freshchat) give you a small JavaScript snippet to add to your site. Paste it into the Body Script field in Settings → Custom Scripts. The chat widget will appear on every storefront page.

Example (Intercom):

<script>
  window.intercomSettings = { app_id: "YOUR_APP_ID" };
  (function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){...}})();
</script>

Paste the full snippet — Cartly handles CSP nonce injection automatically.

Add GA4 or Any Analytics Script

  1. Get your script snippet from the analytics provider.
  2. Go to Settings → Custom Scripts.
  3. Paste the snippet into the Head Script field (most analytics scripts load from <head>).
  4. Save.

CSP and Security

Cartly storefronts use a Content Security Policy to protect your customers. Scripts that are not on the allowlist would normally be blocked by the browser. Cartly automatically adds a security nonce to every <script> tag you paste in the Custom Scripts fields — your scripts execute correctly without any extra steps from you.

What Pages Are Covered?

Site-wide scripts fire on all pages served by the Liquid rendering engine:

  • Home page
  • Product pages
  • Collection pages
  • Cart page
  • Blog listing and article pages
  • Search results
  • CMS pages
  • Login, register, and account pages

The React-rendered checkout and thank-you pages are not covered by site-wide scripts. Use Preferences → Checkout / Order Status Scripts for conversion tracking on the thank-you page.

Notes

  • Scripts load in the order head → body — head scripts run before the page is fully rendered; body scripts run after.
  • If you add two or more script tags to the same field, all of them will execute.
  • Platform administrators can disable custom scripts globally. If the editor shows "Custom scripts are disabled by the platform", contact your platform provider.
Was this helpful?