FAQ
This document clarifies common questions regarding the JavaScript SDK (hereafter referred to as "SDK").
Distinguishing Between Members and Non-members
The SDK differentiates between a member user and a non-member (unknown user) depending on whether the memberId is specified in the boot option during the boot.
For more details, refer to boot.
Setting a User's Profile Without User Interaction
For setting up a member user's profile without user action, refer to the member user boot code in boot.
Positioning the Channel Button
To position the channel button, navigate to Channel settings > General > Manage Plug-in > Web Plugin Setting in the desk.
Changing the Image of a Channel Button
You can set the image of a channel button via Channel settings > General > Manage Plug-in > Web Plugin Setting in the desk.
Customizing the Channel Button with HTML Elements
For customizing the channel button using HTML elements, see how to customize channel button.
Selecting HTML Elements in SDK by CSS Selector
The SDK does not provide CSS selectors for choosing HTML elements like the channel button or messenger.
Avoid using the id and class of the SDK's HTML elements as CSS selectors.
These values might change unexpectedly.
Handling Elements Hidden Behind Others on the Website
To prevent HTML elements like channel buttons and messengers from being obscured by other elements on the website, adjust the zIndex n the boot option to change the elements' z-index.
Utilizing Workflow and Marketing Features in an SPA Environment
In Single Page Applications (SPA), the SDK and Channel Talk server do not automatically detect URL changes. To utilize workflow and marketing features effectively:
- When the web application's URL changes, use setPage to update the current page information in the SDK:
ChannelIO('setPage', 'CURRENT_PAGE');
- Then, use track o send a PageView event, which includes the current page information as set by setPage.
ChannelIO('track', 'PageView');
This method ensures the SDK and Channel Talk server accurately recognize the user's current page and provide relevant marketing messages and workflow interactions.
For more detailed information about events and pages, please refer to What is an Event and What is a page.
Updated 6 months ago