diff --git a/src/connections/sources/catalog/libraries/website/javascript/troubleshooting.md b/src/connections/sources/catalog/libraries/website/javascript/troubleshooting.md index 2ca1a0ce7f..667b44f67d 100644 --- a/src/connections/sources/catalog/libraries/website/javascript/troubleshooting.md +++ b/src/connections/sources/catalog/libraries/website/javascript/troubleshooting.md @@ -229,6 +229,22 @@ You'll also need to modify the Segment script with your `nonce` tag, which shoul Analytics.js generates a campaign object inside the context object whenever the URL contains search parameters. Without any UTM parameters, the campaign object remains empty. + +## What causes "analytics.ready" to fire? Just the SDK loading? + +The analytics.ready method is triggered after the analytics.js SDK has been successfully loaded and all the device-mode destinations that you've connected to the source have been initialized. This means it's not just the analytics.js SDK loading itself that causes this method to fire, but also the successful initialization of any third-party destinations tools you've set up through Segment. This method is particularly useful for executing any code that depends on these analytics services being fully initialized. + + +## Is the "analytics" object generated by the SDK without cookies being set/data being collected? + +Yes, the analytics object is created by the SDK as soon as the analytics.js script is loaded into the page. This object is available for use immediately to queue up tracking calls, even before any cookies are set or data is collected. The actual setting of cookies and collection of data typically begins after you've explicitly called methods like analytics.identify(), analytics.track(), or analytics.page(), among others. However, the presence of the analytics object itself does not imply that cookies have been set or data has been collected. + + +## Is the "analytics.load" method call what actually starts cookies/data collection? + +The analytics.load method call is what initiates the Segment analytics functionality on your website, including the setting of cookies and the collection of data. This method is responsible for loading the analytics.js library onto the page, initializing your configuration, and setting up the initial state. Once analytics.load is called with your Segment write key, the SDK is activated, and it can start setting cookies to track user identities and collecting data based on the tracking methods (identify, track, page, etc.) you call thereafter. + + ## Known issues: [Review and contribute to these on GitHub](https://github.com/segmentio/analytics.js/issues).