Kentico Cloud Tracking SDK
The library supports ES2015 and is fully written in TypeScript.
npm i rxjs --save npm i kentico-cloud-tracking --save
Usage with RxJS (recommended)
We strongly recommend using
Observable instead of
Promise as observables support all that Promises too, and much more. Using
Observables is especially important if you are building any modern application (for example, single page apps with React or Angular) as it allows you to easily cancel, merge, flatten or retry requests.
After creating a subscription, don't forget to unsubscribe when you don't need the result anymore (for example, when navigating to a different page).
// Starts a new sessionclient.recordNewSession.getObservable.subscribe;// Record a custom activityclient.recordCustomActivity,"Clicked_facebook_icon".getObservable.subscribe;// Creates a contact profileclient.createContactProfile.getObservable.subscribe;
Usage with Promise
For whatever reason, you can still use good old Promises:
|projectId||string||ProjectId of your Kentico Cloud project|
|enableAdvancedLogging||boolean||Indicates if advanced (developer's) issues are logged in the console. Enable for development and disable in production.|
|baseUrl||string||Can be used to configure custom base URL (e.g., for testing)|
|retryAttempts||number||Number of retry attempts when an error occurs. Defaults to '3'. Set to '0' to disable.|