How to add an AI chatbot to any website (HTML)
To add an AI chatbot to any website, paste its code right before the closing </body> tag of every page. This guide uses Sincra, an AI assistant that answers your visitors from your own pages and files. Its code is two lines, ready in your Sincra dashboard with your account ID already filled in. This guide works for any website where you can edit the HTML.
What do I need before I start?
- A Sincra account with your email verified. The Free plan is enough, and it covers one domain. The assistant answers your visitors only while your account has a plan, free or paid. You can try it first in the Simulator of your dashboard.
- Access to the HTML of your website, or someone who can edit it for you.
Step 1: Add your domain to Allowed domains
In your Sincra dashboard, open the Widget page and add your website domain, for example example.com, under Allowed domains. The widget only appears on the domains in that list and on their subdomains, so example.com also covers www.example.com and shop.example.com.
If you gave your website when you signed up, its domain is already in the list. While the list is empty, the dashboard does not show your code.
Step 2: Copy your code
On the same page, find the Installation card and click Copy. Your code looks like this, with your own account ID in it:
<script src="https://sincra.cloud/embed.js" data-tenant-id="YOUR_ACCOUNT_ID" data-turnstile-sitekey="..." data-api-host="https://sincra.cloud" data-mode="web" defer></script>
<sincra-widget></sincra-widget>
Copy it from your dashboard, not from this page. The example above does not work as it is.
Step 3: Paste it right before the closing body tag
Open the HTML of your website and paste the code right before </body> on every page where you want the assistant. If your site uses a shared template or footer file, paste it there once and it reaches every page that uses it.
Paste the code only once per page. If you installed Sincra before, remove the old code first.
Step 4: Publish and check that it works
- Publish your changes. If your site uses a cache or a caching plugin, clear it.
- Open your website in a private browser window, so you see the new version.
- Open the chat and ask a question that your pages answer.
The assistant replies from your content and can show links to the pages it used.
If it can't answer a basic question, such as your opening hours or your prices, your pages may not say it yet. 10 basic questions your business website should answer helps you find the gaps.
Can I open the chat from my own buttons or links?
Yes. Add data-sincra-open to any button or link on your page, and a click on it opens the chat:
<button type="button" data-sincra-open>Chat with us</button>
To open the chat with a question already sent, use data-sincra-message:
<button type="button" data-sincra-message="What are your opening hours?">Opening hours</button>
The question is sent as if the visitor had typed it, so its answer counts as one response of your plan.
If you prefer JavaScript, call window.Sincra.open(), window.Sincra.open({ message: "What are your opening hours?" }) or window.Sincra.close(). A question is only sent right after a click or a tap of the visitor. Without one, the chat opens and the question is not sent, so a page cannot use up responses on its own.
These buttons and window.Sincra.open() only work where the widget shows. If "Show the widget on your website" is turned off in the Widget page, or the page is in "Hide on these pages", they do nothing.
Why doesn't the assistant work on my site?
- Your domain is not in Allowed domains, or it is written differently from the address of your site.
- Your email is not verified yet, so your account has no plan.
- "Show the widget on your website" is turned off in the Widget page of your Sincra dashboard.
- You are on the Free plan and this is not the first domain in the list. The Free plan covers one domain.
- The page is an old cached copy. Clear your site cache and reload it in a private window.
- The code is not on that page, or it was pasted somewhere other than right before
</body>.
More checks, step by step: The assistant doesn't show on my website.
Does my site's Content Security Policy need changes?
Most websites don't have a Content Security Policy, and then there is nothing to change. If yours sends one, it must allow Sincra, or the assistant won't load or won't answer. Add these sources to your policy:
script-src https://sincra.cloud
connect-src https://sincra.cloud https://sincra-prod-app-gr535u4h4q-no.a.run.app
frame-src https://sincra.cloud
style-src 'unsafe-inline'
If your policy doesn't list one of these directives, browsers fall back to default-src (for frame-src, to child-src first if you have it), so add the sources there. If your style-src uses a nonce or a hash, browsers ignore 'unsafe-inline': in that case, write to support@sincra.cloud.
What each line is for: the assistant's script loads from sincra.cloud, it talks to our servers at the two addresses in connect-src, its bot check runs in a small frame from sincra.cloud, and it styles itself with an inline style block. It loads no images, fonts or other scripts on your pages.
What if the code is on the page twice?
Keep one Sincra code on each page. If you paste a new code, remove the old one first: two codes on the same page don't work correctly.
Does it slow down my website?
The script tag has the defer attribute. The browser downloads it without blocking your page and runs it after the page has been parsed, so your content shows first.
Can someone else install it for me?
Yes. Check that your domain is in Allowed domains, then use "Email the code to the person who runs your website", under the code in your dashboard. It opens your email with the code and a link to the install guides. They only need to paste it.