ConstructorIO class is the main entry point for the Constructor.io JavaScript Client SDK. It provides access to all SDK modules including search, browse, autocomplete, recommendations, tracking, quizzes, and agent functionality.
Constructor
Creates a new instance of the ConstructorIO client.Parameters
Configuration options for the client
Returns
AConstructorIO instance with the following module properties:
search- Interface to the Search modulebrowse- Interface to the Browse moduleautocomplete- Interface to the Autocomplete modulerecommendations- Interface to the Recommendations moduletracker- Interface to the Tracker modulequizzes- Interface to the Quizzes moduleagent- Interface to the AI Shopping Agent moduleassistant- Interface to the Assistant module (deprecated, useagentinstead)
Example
DOM-less Environment Example
setClientOptions
Updates the client options after initialization. This method allows you to modify certain client settings without creating a new instance.Parameters
Client options to update
Returns
void
Example
Notes
- Only the specified options will be updated; other options remain unchanged
- The
sessionIdparameter will only be updated in DOM-less environments - To clear the
userId, passnullorundefinedas the value - The
sendTrackingEventsoption also updates the tracker module’s configuration