Skip to content

Widget and signed-in users

The website widget gives your visitors chat, your help centre and a way to leave a message, on every page of your site. This guide adds it, then shows how to make it recognise your signed-in users, so your team sees who they’re talking to and the customer never has to type their name or email.

Paste this before </body> on every page, with your product’s public ID (prod_…, from Website widget → Install in the dashboard):

<script src="https://dashboard.supportaka.com/widget.js" data-product="prod_YOUR_PUBLIC_ID" async></script>

The widget only loads on the websites you allow for the product, set in the product’s settings in the dashboard. The Install tab also has steps for WordPress, Shopify, Wix, Squarespace and Webflow.

Anyone can type a name and email into a chat. Identity verification lets your server vouch for who a visitor is instead: your backend signs a short-lived token for the signed-in user, and the widget passes it to Supportaka. The customer is found (or created) with your user’s ID, and their name and email are trusted because you signed them.

  1. Turn it on. In the dashboard, open Website widget → Signed-in visitors and choose Turn on. Copy the identity secret: it’s shown once. Only owners can do this. Store it on your server as SUPPORTAKA_IDENTITY_SECRET.

  2. Sign a token on your server for the signed-in user. It’s a JWT signed with HS256 and these claims:

    Claim Value
    aud "supportaka"
    pid Your product’s public ID (prod_…)
    sub Your own stable user ID, as a string. It’s how the same person is found next time
    email Optional. Trusted as verified
    name Optional
    iat, exp Issued and expiry times, at most 10 minutes apart
    // npm install jsonwebtoken
    import jwt from 'jsonwebtoken';
    export function supportakaToken(user) {
    return jwt.sign(
    {
    aud: 'supportaka',
    pid: 'prod_YOUR_PUBLIC_ID',
    sub: String(user.id),
    email: user.email,
    name: user.fullName,
    },
    process.env.SUPPORTAKA_IDENTITY_SECRET,
    { algorithm: 'HS256', expiresIn: '10m' },
    );
    }
  3. Hand it to the widget on pages where the user is signed in, after the widget’s script tag:

    <script>
    window.Supportaka = window.Supportaka || [];
    window.Supportaka.push(['identify', '<?= supportaka_token($user) ?>']);
    </script>

    Render the token into the page from your server, or fetch it from an endpoint of yours that only answers signed-in users. It’s fine to call identify after the widget has started, for example right after the user signs in.

  • Tokens are short-lived (10 minutes at most), so make a new one per page load or session refresh. An expired or badly signed token is silently ignored and the visitor stays anonymous; the widget never says why, so check your claims and secret if users aren’t recognised.
  • sub is the key. Use an ID that never changes (not the email). If a customer with that email already exists, they’re linked to your sub.
  • Nothing the browser says is trusted without your signature, so a visitor can’t pretend to be someone else.
  • The customer then shows up in the API like any other: sync customers to add your own fields and labels.