CrossTalk tabbed Live Chat JavaScript Documentation
This documentation helps you add tabbed Live Chat ( bottom-right of the page similar to facebook chat ) to your webpage with CrossTalk's JavaScript SDK.
Import the SDK
Add the below script tag to your HTML file. Add this before you call the chat initialisation function
<script src="https://unpkg.com/crosstalk-comments-js"></script>
Add the CrossTalk chat initialisation code after importing the CrossTalk JS SDK
Add the below javascript code to initialise tabbed chats. You can add multiple URLs and pageIDs for multiple chat tabs.
<script>
CTCore.initTabbedChats({
wp: 'crosstalkDemo',
pageIDs: [
{
pageID: 'test',
collapsed: false,
title: 'Home'
}
]
});
</script>
Sign up for your
CrossTalk
account
to get your unique WebProperty Name and start engaging with your audience
through live chat!
List of params for CrossTalk Live Chat:
| Variable Name | Definition | Expected Values |
|---|---|---|
wp |
Your unique WebProperty Name. You can create Web Properties from the Dashboard | Example: 'crosstalkDemo'. String value expected |
pageIDs |
An array of objects containing a chat objects. Each chat object contains
pageID, url, title and collapsed
|
Array of objects expected |
pageID (inside pageIDs array) |
A PageID that uniquely identifies a page in your WebProperty. If you have a CMS
system, an article's slug would be a good PageID.
If you embed CrossTalk in your app, sharing the PageID would make sure the same live chat load if the same page is opened on your Website or App Send either pageID or url. If both are sent,
pageID takes precedence.
|
Example: 'some-Slug-123'. String value expected |
url (inside pageIDs array) |
If you don't maintain PageIDs, sending the canonical URL works as well. This will
dynamically load live chat based on the URL of the website. Send either pageID or url. If both are sent,
pageID takes precedence.
|
`${window.location.origin}${window.location.pathname}`
|
title (inside pageIDs array) |
Title of the tabbed chat. Make it user-friendly so the user knows what this chat group is about | Example: 'Breaking News'. String value expected |
collapsed (inside pageIDs array) |
Whether to open the chat on page load or keep it collapsed. True keeps the chat collapsed |
Either true or false. Boolean value expected
|
Use the sample web property
crosstalkDemo to test the widget right away.