initialized

From Genesys Documentation
Revision as of 11:59, July 15, 2020 by WikiSysop (talk | contribs) (Text replacement - "\|Platforms?=([^\|]*)PureCloud([\|]*)" to "|Platform=$1GenesysCloud$2")
Jump to: navigation, search
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 be notified when the Journey JavaScript SDK has fully initialized.

Description

Use the initialized 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 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 api.session methods, will 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.

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:49:52)"
Comments or questions about this documentation? Contact us for support!