Skip to content

Install Sam manually (any site)

If your site doesn’t fit any of our other install guides — a custom-built site, a static-site generator like Hugo or 11ty, an in-house CMS — this is the catch-all method.

Prerequisites

  • Edit access to your site’s HTML (or templates)
  • A Sam account at viasam.app
  • Your Sam API token

The snippet

Paste this into your site’s HTML, right before the closing </body> tag, on every page where you want the widget to appear:

<script src="https://cdn.viasam.app/v1/widget.js" data-api-key="YOUR_API_KEY" defer></script>

Replace YOUR_API_KEY with your actual token (copy from your Sam dashboard → Widgets → Install your widget → Other / manual).

Where to put it

Site typeLocation
Static HTMLRight before </body> in every page (or your shared layout/footer file)
Hugo / Jekyll / 11tyInside _layouts/default.html (or your site’s layout template) before </body>
Express / Next.js / Remix / NuxtIn your root layout component, just before </body>
Django / Rails / LaravelIn your site’s master/base template’s footer block
React SPA without SSRAdd the <script> tag to public/index.html directly

The defer attribute means the widget loads after your page content — it never blocks page rendering.

Verify

Open your site in a new tab. The Sam widget should appear in the corner you configured.

If it doesn’t, open browser dev tools (F12), go to Console, reload the page, and look for any errors mentioning widget.js or cdn.viasam.app.

Troubleshooting

Widget appears once but not on subsequent navigations (SPA). If you have a single-page app with client-side routing, the script only loads once on initial page load. The widget itself handles route changes automatically — you don’t need to re-inject the script.

Widget loads but says “Invalid API key”. Double-check the data-api-key value matches your Sam dashboard. Tokens are 40 alphanumeric characters.

Content Security Policy blocks the script. Allow https://cdn.viasam.app in your script-src directive. The widget will also try to fetch from https://viasam.app/api/widget/config/..., so allow https://viasam.app in connect-src too.

Widget appears in the wrong corner. Position is configured per-widget in your Sam dashboard, not in the snippet. Open the widget settings and change the position there — no need to redeploy.

Need help?

Email support@viasam.app with a link to your site and we’ll take a look.