- Load and initialize the widget on page load
- Automatically log in a predefined user
- Display a docked chat window on your site
Quick Steps to Embed CometChat Widget
1
Register on CometChat & Gather Your Keys
Before you begin, sign up at the CometChat Dashboard and create a new app. Copy:
- App ID
- Region
- Auth Key
2
Inject the Chat-Embed Script into `<head>`
- In your Squarespace Dashboard, go to Website → Pages → Custom Code → Code Injection.
-
In the Header box, paste:
3
Embed the Widget Container & Init Script
- Still under Website → Pages → Custom Code → Code Injection, scroll to the Footer box.
-
Paste the following just before
</body>
:
Replace<YOUR_APP_ID>
,<YOUR_APP_REGION>
,<YOUR_AUTH_KEY>
, andCOMETCHAT_USER_UID
with your actual credentials and user ID.
4
Optional: Page-Specific Embedding
If you only want the widget on a single page, instead of site-wide:
- In Pages, hover the desired page → ⚙️ Page Settings → Advanced.
- Paste the
<div id="cometChatMount"></div>
into Page Header or Page Footer. - Use a Code Block in the page editor if you want to position the widget within specific content.
5
Troubleshooting
- Widget not appearing?
- Verify your App ID, Region & Auth Key.
- Check browser console for errors (CSP, ad-blockers).
- Login fails?
- Ensure the
COMETCHAT_USER_UID
matches an existing user in your CometChat Dashboard.
- Ensure the
- Styling issues?
- Add custom CSS in Design → Custom CSS to override default widget styles.
Advanced JavaScript APIs
Once the widget is loaded, interact with it via the globalCometChatApp
object:
Chat and Call Methods
UI Event Listeners
User and Group Management
Authentication Methods
Localization
With language localization, our Chat Widget adapts to the language of a specific country or region. Chat Widget allows you to detect the language of your users based on their browser settings and set the language of the widget accordingly. You can also set the language manually using theCometChatApp.localize
method.
The CometChat App supports localization for multiple languages, allowing you to provide a tailored experience for users across different regions.
You can find the list of supported languages and their corresponding language codes below:
Language | Code |
---|---|
English (United States) | en-US |
English (United Kingdom) | en-GB |
Dutch | nl |
French | fr |
German | de |
Hindi | hi |
Italian | it |
Japanese | ja |
Korean | ko |
Portuguese | pt |
Russian | ru |
Spanish | es |
Turkish | tr |
Chinese | zh |
Chinese (Traditional) | zh-TW |
Malay | ms |
Swedish | sv |
Lithuanian | lt |
Hungarian | hu |
- JavaScript
Parameter | Description | Type |
---|---|---|
LANGUAGE_CODE | The language code the texts to be translated into | Required |