-
Notifications
You must be signed in to change notification settings - Fork 6
Utilization in a DOM less environment
ST P edited this page Jan 11, 2023
·
8 revisions
Available in version 2.20.0 and above
Utilizing constructorio-client-javascript
within a DOM-less environment (such as React Native) is supported, though there are some notes to be aware of.
constructorio-client-javascript
makes use of DOM features (specifically, cookies and local storage) in order to store parameters utilized to personalize results. When operating outside of a traditional DOM based environment, these parameters cannot be persisted and will need to be supplied through a custom implementation when instantiating the client.
For example:
const instance = new ConstructorIO({
apiKey,
clientId,
sessionId,
userId,
sendTrackingEvents: true,
});
Parameter | Required | Type | Description |
---|---|---|---|
apiKey |
✔ | string | A string provided by a Constructor.io employee corresponding to the index to retrieve data from |
clientId |
✔ | string | A unique string of randomly generated characters to anonymously identify a user. Implementation within constructorio-identity may be found here
|
sessionId |
✔ | integer | An integer (starting with 1 ) that notes a user's current session. This value should be incremented after 30 minutes of inactivity. Implementation within constructorio-identity may be found here
|
userId |
string | A string corresponding to an internal unique user identifier for logged in customers. This helps Constructor to carry over any learnings for a user account across devices. | |
sendTrackingEvents |
boolean | A boolean value that defaults to false indicating whether or not to send tracking events. Set this parameter to true if using the client to implement tracking |