Difference between revisions of "ATC/Current/SDK/initialized"
(Published) |
(Published) |
||
Line 3: | Line 3: | ||
|DisplayName=initialized | |DisplayName=initialized | ||
|TocName=initialized | |TocName=initialized | ||
− | |Context=Learn how to use the <code>initialized</code> method to receive notification when the Journey JavaScript SDK has initialized fully. | + | |Context=Learn how to use the <code>initialized</code> method to receive notification when the Journey JavaScript SDK has initialized fully.{{BarbFeatureTemp|Feature=Web messaging}}This article only applies to customers using web chat. If you are a Genesys Cloud customer, we encourage you to use the new {{Link-AnywhereElse|product=ATC|version=Current|manual=AdminGuide|topic=About_web_messaging|display text=web messaging}} feature to replace web chat. |
|Dimension=initialization methods | |Dimension=initialization methods | ||
|ComingSoon=No | |ComingSoon=No |
Revision as of 18:30, April 28, 2021
Contents
Learn how to use the initialized
method to receive notification when the Journey JavaScript SDK has initialized fully.
This article only applies to customers using web chat. If you are a Genesys Cloud customer, we encourage you to use the new web messaging feature to replace web chat.
Description
Use the initialized
method to receive notification when the Journey JavaScript SDK initializes fully. This information is useful in situations that require tracking data from the Journey JavaScript SDK, but because SDK initialization takes place after the page loads, tracking has not begun.
For example, some businesses require GDPR consent before they begin tracking visitor activity. A business can present a GDPR consent confirmation request to a visitor when the visitor arrives at the webpage. Until the visitor agrees to allow tracking, the Journey JavaScript SDK remains in an uninitialized state, and calls to SDK methods, such as the api.session methods, fail.
After the visitor provides their consent, the SDK initializes and can begin tracking visitor activity. Once initialized, callbacks registered using the initialized method are invoked and can begin to use the Journey JavaScript SDK's other methods.
Signature
ac('initialized', <function> eventHandler);
Example
ac('initialized', () => {
console.log('Tracking SDK initialized');
ac('api.session.getData', (session) => {
console.log('Session data', session);
});
});