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.

AttributeRequiredDefaultNotes
data-keyYesnoneYour publishable key (pk_…).
data-apiNothe script's own addressLeave this out unless we ask you to set it.
data-titleNoChat with us (在线客服 in a Chinese browser)Text in the chat header.
data-accentNo#2563ebAccent 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-positionNorightright or left.
data-greetingNoHi! How can I help? (您好!有什么可以帮您? in a Chinese browser)The first message visitors see.
data-greeting-<lang>NononeGreeting for visitors whose browser language starts with <lang>, for example data-greeting-zh. Falls back to data-greeting. See the Languages page.
data-bgNo#fffBackground of the panel and Tio's message bubbles. Same formats as data-accent. Use a light colour: Tio's text stays dark.
data-radiusNo12Corner radius in pixels, a whole number from 0 to 24.
data-fontNothe system font stackA 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.php and paste the snippet just before wp_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

  1. Open a page on your live site (not localhost).
  2. Check the chat button appears in the corner you chose.
  3. Ask a question your website answers, such as your opening hours or a service you offer. The reply should link to your pages.
  4. Ask something your website doesn't cover. Tio should say so and offer to put the visitor in touch with your team.
Contact us