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")
(Published)
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
 
|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 user 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 21:
 
|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 30:
 
|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 38:
 
});
 
});
 
</syntaxhighlight>
 
</syntaxhighlight>
|structuredtextwide=
 
|FAQHeading=
 
 
|Status=No
 
|Status=No
 
}}
 
}}
 
}}
 
}}

Revision as of 19:46, December 16, 2020

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.

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 user 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 22:43:44)"
Comments or questions about this documentation? Contact us for support!