Widget setup and configuration
Contents
The Support widget is a chat interface that appears on your website, allowing users to start conversations with your team. It loads automatically when enabled and captures session context for each ticket.
Enabling the widget
- Go to Support in PostHog and click Settings
- Click Enable conversations (if not already enabled)
- Go to the In-app widget section and enable it
- Configure your settings (see below)
- Save
The widget appears as a floating button on your site. By default it appears in the bottom-right corner, but you can customize its position in the settings.
Widget configuration
These settings are configured in the In-app widget section of Support settings.
| Setting | Description | Options | Default |
|---|---|---|---|
| Enable widget | Show the chat widget on your site | true, false | false |
| Button color | Primary color for the widget (hex) | Any hex color | #5375ff |
| Widget position | Position of the widget on screen | bottom_right, bottom_left, top_right, top_left | bottom_right |
| Greeting message | Welcome text shown when widget opens | Any string | "Hi! How can we help?" |
| Allowed domains | Restrict which domains can show the widget | Array of domain strings | [] (all domains) |
Identification form
You can optionally require users to identify themselves before starting a conversation:
| Setting | Description | Default |
|---|---|---|
| Require email | Users must enter their email to start chatting | false |
| Collect name | Additionally collect a name | false |
| Form title | Heading shown on the identification form | "Before we start..." |
| Form description | Subtext shown below the title | "Please provide your details so we can help you better." |
When enabled, the form appears before they can send their first message. The collected information is used to link the ticket to a person in PostHog.
Domain restrictions
You can restrict which domains the widget appears on for security:
If domains is empty or not set, the widget shows on all domains.
Controlling widget visibility
Use the JavaScript API to programmatically show or hide the widget:
This is useful for:
- Showing the widget only on certain pages
- Triggering the widget from a custom button
- Hiding the widget during specific user flows
Disabling the widget via config
You can disable conversations entirely via the PostHog init config:
This is different from hiding the widget – it completely disables the feature.
Recover tickets across browsers
Support tickets are tied to the browser session by default. If a user switches browsers or clears their storage, they won't see their previous tickets. The widget includes a Recover your tickets link to handle this.
How recovery works
- Click Recover your tickets in the ticket list
- Enter the email address used in previous conversations
- A recovery link is sent to that email (expires in one hour)
- Click the link to open the widget and restore tickets in the new browser
If the page URL contains a ph_conv_restore query parameter (from clicking the recovery link), tickets are automatically restored on page load. The parameter is removed from the URL after processing.
Identity verification
If your app has logged-in users, identity verification works better than email-based recovery. You sign the user's distinct ID on your server, and tickets persist across browsers and devices automatically – no user action required.
How it works
- Your server computes an HMAC-SHA256 hash of the user's
distinct_idusing your team'ssecret_api_token - You pass this hash along with the
distinct_idto the widget - The widget API verifies the signature and uses the
distinct_idfor ticket lookup instead of the browser session
With identity verification enabled, users see all their tickets on any browser or device.
Server-side implementation
Generate the identity hash on your backend. Never expose your secret_api_token in client-side code.
Passing identity to the widget
Once you've computed the hash on your server, pass it to your frontend and set it on the PostHog SDK.
Option 1: Set identity at initialization
If you know the user's identity when PostHog initializes (like on a server-rendered page), pass it in the init config:
Option 2: Set identity after login
For single-page apps — or when the user logs in after page load — call setIdentity():
Clear identity on logout
When a user logs out, clear their identity so the widget falls back to session-based access:
Your secret_api_token must never be exposed in client-side code. Always compute the identity hash on your server and pass only the hash to the frontend.
When to use identity verification
| Scenario | Recommended approach |
|---|---|
| Logged-in users | Use identity verification for seamless cross-device access |
| Anonymous visitors | Use the default widget session (no setup required) |
| Mixed audience | Use identity verification when users are logged in, fall back to widget session for anonymous users |
If your team doesn't have a secret_api_token configured, identity verification is ignored and the widget falls back to session-based access control.
Email notifications
Configure your team to receive email alerts when new tickets arrive.
Setting up notifications
- Go to Settings > Support in PostHog
- Find the Email notifications section
- Select team members who should receive alerts
What emails include
- Team name
- Ticket number
- First message preview
- Direct link to the ticket
Recipients must have access to the team to receive notifications.
For more control over notifications – like sending alerts only for high-priority tickets, routing to specific Slack channels, or notifying different teams based on tags – use workflow automation. Workflows let you trigger Slack messages, webhooks, and more based on any ticket event.
Browser notifications
Individual team members can enable browser notifications for new ticket activity.
- Go to Support in PostHog
- Enable Browser notifications in the notification settings
When enabled, a desktop notification appears when the unread ticket count increases. This works independently of email notifications – you can use one or both.
Public token
The widget uses a public token for authentication. This token is automatically generated and shown in your Support settings. It's safe to expose in client-side code.
If you need to reset the token:
- Go to Support > Settings
- Click Regenerate token
Resetting the token stops current chats. Users need to refresh the page to reconnect with the new token.