Install Tio
Tio is added with one <script> tag. It works on any website: plain HTML, Next.js, WordPress and others. A chat button appears in the bottom corner of the page.
1. Paste the snippet
Put this just before the closing </body> tag, and replace pk_your_key_here with the key we gave you:
<script src="https://tio.tyo.com.au/tio.js"
data-key="pk_your_key_here"
data-title="Ask us anything"
data-accent="#2563eb"
data-greeting="Hi! How can I help?"></script>
Only data-key is required. The browser only ever sees this publishable key (pk_…). It is safe to put in your page source.
2. Settings
All settings are data-* attributes on the script tag.
| Attribute | Required | Default | Notes |
|---|---|---|---|
data-key | Yes | none | Your publishable key (pk_…). |
data-api | No | the script's own address | Leave this out unless we ask you to set it. |
data-title | No | Chat with us (在线客服 in a Chinese browser) | Text in the chat header. |
data-accent | No | #2563eb | Accent colour: hex, rgb(), hsl() or a CSS colour name. Text on the accent is white or dark, whichever is easier to read (with a colour name, it stays white). |
data-position | No | right | right or left. |
data-greeting | No | Hi! How can I help? (您好!有什么可以帮您? in a Chinese browser) | The first message visitors see. |
data-greeting-<lang> | No | none | Greeting for visitors whose browser language starts with <lang>, for example data-greeting-zh. Falls back to data-greeting. See the Languages page. |
data-bg | No | #fff | Background of the panel and Tio's message bubbles. Same formats as data-accent. Use a light colour: Tio's text stays dark. |
data-radius | No | 12 | Corner radius in pixels, a whole number from 0 to 24. |
data-font | No | the system font stack | A font-family list (up to 120 characters). A web font your page already loads also works inside the widget. |
A value that isn't valid falls back to the default.
3. Where to paste it
Plain HTML
Paste the snippet just before </body> on every page where you want the chat. If your site shares a footer file, put it there once.
Next.js (pages router)
Add the script to pages/_document.js, before the closing </body>:
import { Html, Head, Main, NextScript } from 'next/document';
export default function Document() {
return (
<Html lang="en">
<Head />
<body>
<Main />
<NextScript />
<script
src="https://tio.tyo.com.au/tio.js"
data-key="pk_your_key_here"
data-title="Ask us anything"
defer
/>
</body>
</Html>
);
}
Next.js (app router)
Use next/script in app/layout.js:
import Script from 'next/script';
export default function RootLayout({ children }) {
return (
<html lang="en">
<body>
{children}
<Script
src="https://tio.tyo.com.au/tio.js"
data-key="pk_your_key_here"
data-title="Ask us anything"
strategy="afterInteractive"
/>
</body>
</html>
);
}
WordPress
Either:
- use a plugin that adds scripts to the header or footer, and paste the snippet into the footer box, or
- edit your theme's
footer.phpand paste the snippet just beforewp_footer().
If you edit the theme directly, use a child theme so a theme update doesn't remove it.
4. Allowed domains
Your key only works on your own website addresses. We set that list when we create the key (for example https://www.yoursite.com.au). On any other site, including localhost on your own computer, the chat shows "This chat isn't available on this site." when you send a message.
If you have a staging site or a second domain, tell us and we'll add it.
5. Content-Security-Policy
If your site sends a Content-Security-Policy header, allow Tio's address in these two directives:
script-src https://tio.tyo.com.au;
connect-src https://tio.tyo.com.au;
If your policy has a style-src directive, it must also allow 'unsafe-inline': the chat styles itself with an inline style block.
Add them to your existing lists rather than replacing them.
6. Don't add integrity=
Do not add a Subresource Integrity (integrity=) attribute to the script tag. We update tio.js in place, so a fixed hash would break the chat on the next update. Every data-* attribute stays backward compatible. If we ever need a breaking change, it will ship at a new address.
7. Test it
- Open a page on your live site (not
localhost). - Check the chat button appears in the corner you chose.
- Ask a question your website answers, such as your opening hours or a service you offer. The reply should link to your pages.
- Ask something your website doesn't cover. Tio should say so and offer to put the visitor in touch with your team.