Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding more details to troubleshooting section.md #6793

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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).