Setting up page load events
You may use page load/page view events as triggers for Display Product Experience. To reliably use these events as triggers, ensure that your event is fired post rendering the Activity or Fragment.
Use the following code snippet to fire page load events in the right methods.
Page load events for dynamic screens
In case if the App needs to make an API call to fetch the data before rendering the screen, then please trigger the page load once the API call returns and the screen is completed rendered. You can alternatively add delay duration from the Hansel dashboard.
@Override
protected void onResume() {
super.onResume();
//Trigger the event here.
AppCleverTap.track(eventName, properties);
//If you are using any other analytics vendor, then you can check in the above section for the appropriate code snippet for that vendor.
}
In case your page load events are not in the above format, you may either modify it or fire a new Hansel event in onResume() method of the Activity or the Fragment (in case you do not wish to modify the existing event). The event can also be fired in onStart()/onCreate() method, depending on use cases.
Hansel requires page load events to be fired only post rendering the Activity or Fragment. This is to ensure that the anchored product experience are placed against the right view. You can alternatively add delay duration from the Hansel dashboard.
Note - If used incorrectly, anchored nudges may be skipped when the Activity or Fragment has not been rendered
Updated 3 months ago