The core of the RSClient is made up of two methods, `initializeWithSiteId` & `track`. The `initializeWithSiteId` method is called once and must be called before any track calls are made.
This method performs some basic initialization required by RSCLient and will make sure that every track call has siteId as a parameter. Once this method is called, the application can start making `track` calls with various custom parameters to track different events. If that is all you need as an App developer there are no other methods required.
The siteId is provided by Retention Science, and the Application instance ideally is passed from the custom Application class (as mentioned previously in the implementation manual). This is the core init function. This must be called prior to any events.
RSClient.track(action) - (and other various parameters)
The "track" method has 3 parts (2 optional), the event action string is always required and is the first parameter. The other optional parameters are a combination of a metadata packet (either in JSONObject or Bundle form) & a Location object. The calls are not instantaneous. This method adds events/items to the main queue. Check here for more details.
This method sets the userId. Potentially after the user is logged in. This userId will be part of each tracking event. The appropriate place to call - after user login is complete or if the application maintains the user session where the Id is retrieved from the session object and passed into this method on application create. This method call will vary from application to application. userId is an optional parameter while tracking events.
This is used primarily to track marketing. This will mark all events to include a source parameter for App developer tracking.
This method provides access to the UUID used by the SDK.
This will check, based on a hash on the event data, whether the event that is being added to the SDK event queue is already in the queue, and prevent additions if it is already there. Please note this will have a small performance impact.
This limits the number of events in the event queue. By default it is unlimited. If you are firing off a very large number of events, this may be worth considering, but the queue should have little impact on performance even if it is large.
This is used if you wish to adjust the number of events cached on disk, which will be restored and resent in the event of extended internet disconnection. If your application is heavily web-dependent, touching this won’t do much. This is more applicable for “light” web-dependent apps.
If a collection of events are filling the queue (haven’t been sent to the Retention Science servers yet), it is possible that those events will be lost if the user loses internet connections, exits the app, and it gets evicted. This method adjusts how many events can be in the queue before new events are also cached to disk.
This method adjusts the event delay (time between events) for those events to be considered part of the same session. If the events are spaced out beyond this, they will generate new session keys on firing.
This simply reduces the thread time spent logging events. This should only be adjusted if you are sending a large volume of events in occasional intervals & these intervals demand very high CPU. It is highly unlikely this will need to be adjusted, but it is provided for convenience.
Used to adjust how many milliseconds an HTTP event will stay open before it is considered a failure and returns an error. Any calls affected by this will be added back into the queue and retried.
This is automatically called as part of the “initializeWithSiteId” call, and it is advised not to trigger it manually unless you have specific needs related to calling cached events.
A simple boolean to check if the Retention Science SDK has been initialized. All “track” calls do this check internally, so there is no need to call this externally.
There is no need to call this method explicitly. It is automatically called if the staging environment is set
by using the appropriate setEnvironment method.
Please sign in to leave a comment.