Configuring Internal Analytics Provider
Step 1: Create new Method
Create a new method triggerAndTrack
in the class which has the code of your in-house analytics provider. We will use the class name “Tracker” through out this document.
public static void triggerAndTrack(String eventName, HashMap<String, Object> properties) {
//1. pass on the event to HanselTracker
HashMap<String, Object> hanselData = HanselTracker.logEvent(eventName, "custom", properties);
//2. Add the data returned by the above method to the existing properties
if (properties == null) {
properties = new HashMap<>();
}
properties.putAll(hanselData);
//3. Call the track method
Tracker.track(eventName, properties);
}
Step 2: Using the new method
For all those events which can work as triggers for nudges or can be the goal events for the nudges, make the updates as suggested in the snippet below:
// If the snippet in code was
Tracker.track(eventName, properties)
// update it to
Tracker.triggerAndTrack(eventName, properties)
Updated 3 months ago