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 ViewController. 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
- (void) viewDidAppear:(BOOL)animated {
  [super viewDidAppear:animated];
  [AppCleverTap recordEvent:eventName withProperties: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.
}
override func viewDidAppear(_ animated: Bool)
{
   super.viewDidAppear(animated);
   AppCleverTap.recordEvent(eventName, properties: 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 event in viewDidAppear() method of the ViewController (in case you do not wish to modify the existing event). The event can also be fired in viewDidLoad()/viewWillAppear() method, depending on use cases.

🚧

Hansel requires page load events to be fired only post rendering the ViewController. 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 ViewController has not been rendered

Updated 3 months ago


Next

Continue setting up Product experience

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.