Skip to main content

Google Tag Manager

  1. In GTM, Tags → New → Custom HTML.
  2. Paste the snippet. GTM injects it into the page for you:
<script src="https://api.mysarthi.tech/widget/v1.js" data-site-key="ws_acme_7f3a9c" async></script>
  1. Trigger: All Pages (or the pages where the bubble should appear).
  2. Preview, then Publish the container.
  3. Add your website under Allowed websites in the console.

Notes​

  • Consent mode. If your tag manager waits for cookie consent before firing tags, the chat bubble will only appear after consent. The widget itself uses the browser's localStorage (not cookies) to continue a chat across page reloads; see Data and privacy for what it stores.
  • Signed-in customers can't be recognised through GTM alone: a token has to be signed on your server. If you need that, load the widget from your site's code instead (React and Next.js shows the pattern) or have your page expose a token endpoint and use a Custom HTML tag with window.Sarthi = { q: [['init', { siteKey, getEndUserToken }]] }.
  • Content Security Policy. If your site has one, the widget's host must be allowed; see CSP and performance.