Install Sam with Google Tag Manager
If your site already uses Google Tag Manager, this is the fastest way to deploy the Sam widget — works regardless of which CMS or platform your site runs on.
Who this is for
Anyone who already has GTM installed on their site. If you don’t, you’ll need to install GTM first (Google’s quickstart) before following this guide.
Prerequisites
- GTM container already installed on your site
- Edit access to your GTM workspace
- A Sam account at viasam.app
- Your Sam API token
Step 1 — Open GTM
Go to tagmanager.google.com and open your workspace.
Step 2 — Create a new tag
- Click Tags in the left sidebar.
- Click New in the top-right.
- Give the tag a name: Sam Widget.
- Click the Tag Configuration box.
- Choose Custom HTML.
Step 3 — Paste the snippet
Paste this into the HTML field, replacing YOUR_API_KEY with your actual API token:
<script src="https://cdn.viasam.app/v1/widget.js" data-api-key="YOUR_API_KEY" defer></script>💡 If you copy the snippet from your Sam dashboard (Widgets → Install your widget → Google Tag Manager), the API key is already filled in.
Leave Support document.write unchecked.
Step 4 — Set the trigger
- Click the Triggering box.
- Choose All Pages.
Step 5 — Save and publish
- Click Save in the top-right.
- Click Submit in the top-right.
- Add a version name like “Add Sam widget” and click Publish.
Step 6 — Verify
Open your site in a new browser tab. The Sam widget should appear in the corner you configured.
If you don’t see it, open browser dev tools (F12), go to the Network tab, reload, and search for widget.js. You should see a 200 response.
Troubleshooting
Widget doesn’t appear. Make sure you clicked Publish, not just Submit Preview. Changes don’t go live until published.
Widget appears on some pages but not others. Confirm the trigger is All Pages, not a specific page-view trigger.
Content Security Policy blocks the script. If your site has a strict CSP, you’ll need to allow https://cdn.viasam.app in your script-src directive.
GTM doesn’t fire on checkout (Shopify). GTM is generally blocked on Shopify checkout pages. Use our Shopify app instead — it injects via a theme app embed which works on checkout.
Need help?
Email support@viasam.app.