Smartech

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.

@Override
protected void onResume() {
   super.onResume();
   //Trigger the event here with a delay. 
   //The delay is to make sure the screen is completely rendered when the event is triggered.
  long delay = 2000;
  Handler handler = new Handler(context.getMainLooper());
  handler.postDelayed(new Runnable() {
      @Override
        public void run() {
        AppCleverTap.track(eventName, properties);
      }
   },delay);
   
  //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).

Updated about a month ago


Next

Go back to this page and follow further steps to complete the Product Experience integration!

Product Experience

Setting up page load events


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.