Difference between revisions of "ATC/Current/SDK/initialized"

From Genesys Documentation
Jump to: navigation, search
m (Text replacement - "\|Platform=([^\|]*)GenesysEngage-onpremises([\|]*)" to "|Platform=$1GenesysEngage-cloud$2")
m (Text replacement - "Genesys Cloud" to "Genesys Cloud CX")
 
(4 intermediate revisions by one other user 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 be notified when the Journey JavaScript SDK has fully initialized.
+
|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=GenesysEngage-cloud, PureConnect, GenesysCloud
+
|Platform=PureConnect, GenesysCloud, GenesysEngage-cloud
|Prereq=
 
 
|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
|Media=
+
|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.
|image=
 
|structuredtext=Use the <code>initialized</code> method to be notified when the Journey JavaScript SDK has fully initialized. This may be useful in situations where tracking data from the Journey JavaScript SDK is required, but because SDK initialization takes place after the page has loaded, tracking has not yet begun.
 
  
For example, some businesses require {{#mintydocs_link:manual=AdminGuide|topic=GDPR|link text=GDPR}} consent before they begin tracking user activity. In this case, a business may present a GDPR consent dialog box to a user when the user arrives at the webpage. Until the user has agreed 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, will fail.
+
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 user provides their consent, the SDK may be initialized and can begin tracking visitor activity. Once initialized, callbacks registered using the initialized method will be invoked and can begin to use the Journey JavaScript SDK's other methods.
+
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.
|structuredtextwide=
 
|FAQHeading=
 
 
|Status=No
 
|Status=No
 
}}{{Section
 
}}{{Section
Line 26: Line 25:
 
|anchor=Signature
 
|anchor=Signature
 
|alignment=Vertical
 
|alignment=Vertical
|Media=
 
|image=
 
 
|structuredtext=<syntaxhighlight lang="javascript">
 
|structuredtext=<syntaxhighlight lang="javascript">
 
ac('initialized', <function> eventHandler);
 
ac('initialized', <function> eventHandler);
  
 
</syntaxhighlight>
 
</syntaxhighlight>
|structuredtextwide=
 
|FAQHeading=
 
 
|Status=No
 
|Status=No
 
}}{{Section
 
}}{{Section
Line 39: Line 34:
 
|anchor=Example
 
|anchor=Example
 
|alignment=Vertical
 
|alignment=Vertical
|Media=
 
|image=
 
 
|structuredtext=<syntaxhighlight lang="javascript">
 
|structuredtext=<syntaxhighlight lang="javascript">
 
ac('initialized', () => {
 
ac('initialized', () => {
Line 49: Line 42:
 
});
 
});
 
</syntaxhighlight>
 
</syntaxhighlight>
|structuredtextwide=
 
|FAQHeading=
 
 
|Status=No
 
|Status=No
 
}}
 
}}
 
}}
 
}}

Latest revision as of 21:28, November 9, 2021

This topic is part of the manual Journey JavaScript SDK for version Current of Genesys Predictive Engagement.

Learn how to use the initialized method to receive notification when the Journey JavaScript SDK has initialized fully.

Important
This article only applies to customers using web chat. If you are a Genesys Cloud CX 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);
  });
});
Retrieved from "https://all.docs.genesys.com/ATC/Current/SDK/initialized (2025-06-23 19:02:23)"
Comments or questions about this documentation? Contact us for support!