Difference between revisions of "ATC/Current/SDK/initialized"
m (Text replacement - "\|Platforms?=([^\|]*)PureCloud([\|]*)" to "|Platform=$1GenesysCloud$2") |
m (Text replacement - "Genesys Cloud" to "Genesys Cloud CX") |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 3: | Line 3: | ||
|DisplayName=initialized | |DisplayName=initialized | ||
|TocName=initialized | |TocName=initialized | ||
− | |Context=Learn how to use the <code>initialized</code> method to | + | |Context=Learn how to use the <code>initialized</code> method to receive notification when the Journey JavaScript SDK has initialized fully. |
|Dimension=initialization methods | |Dimension=initialization methods | ||
|ComingSoon=No | |ComingSoon=No | ||
− | |Platform= | + | |Platform=PureConnect, GenesysCloud, GenesysEngage-cloud |
− | |||
|Section={{Section | |Section={{Section | ||
+ | |alignment=Vertical | ||
+ | |structuredtext={{NoteFormat|1=This article only applies to customers using {{Link-AnywhereElse|product=ATC|version=Current|manual=AdminGuide|topic=About_web_chats|display text=web chat}}. If you are a Genesys Cloud CX 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.|2=}}<br /> | ||
+ | |Status=No | ||
+ | }}{{Section | ||
|sectionHeading=Description | |sectionHeading=Description | ||
|anchor=Description | |anchor=Description | ||
|alignment=Vertical | |alignment=Vertical | ||
− | + | |structuredtext=Use the <code>initialized</code> 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. | |
− | |||
− | |structuredtext=Use the <code>initialized</code> method to | ||
− | For example, some businesses require {{#mintydocs_link:manual=AdminGuide|topic=GDPR|link text=GDPR}} consent before they begin tracking | + | For example, some businesses require {{#mintydocs_link:manual=AdminGuide|topic=GDPR|link text=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 {{Link-SomewhereInThisVersion|manual=SDK|topic=Session_methods|display text=api.session}} methods, fail. |
− | After the | + | 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. |
− | |||
− | |||
|Status=No | |Status=No | ||
}}{{Section | }}{{Section | ||
Line 26: | Line 25: | ||
|anchor=Signature | |anchor=Signature | ||
|alignment=Vertical | |alignment=Vertical | ||
− | |||
− | |||
|structuredtext=<syntaxhighlight lang="javascript"> | |structuredtext=<syntaxhighlight lang="javascript"> | ||
ac('initialized', <function> eventHandler); | ac('initialized', <function> eventHandler); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
|Status=No | |Status=No | ||
}}{{Section | }}{{Section | ||
Line 39: | Line 34: | ||
|anchor=Example | |anchor=Example | ||
|alignment=Vertical | |alignment=Vertical | ||
− | |||
− | |||
|structuredtext=<syntaxhighlight lang="javascript"> | |structuredtext=<syntaxhighlight lang="javascript"> | ||
ac('initialized', () => { | ac('initialized', () => { | ||
Line 49: | Line 42: | ||
}); | }); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
|Status=No | |Status=No | ||
}} | }} | ||
}} | }} |
Latest revision as of 21:28, November 9, 2021
Contents
Learn how to use the initialized
method to receive notification when the Journey JavaScript SDK has initialized fully.
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);
});
});