In-app events for hybrid apps

In-app events give you comprehensive data about user activity. In-app events occurring in the app are reported using the SDK. To report events that don't occur within the app there are a number of scenarios:

  • The event takes place on your website: Implement People-Based Attribution (PBA)  to get a unified view of customer journeys across channels, platforms including the website, and devices. This provides you with Web-to-App, Conversion paths analysis, and raw-data. 
  • Hybrid:  The event takes place on your mobile website on a device having the app as described in this article. In-app events are recorded by calling the AppsFlyer SDK API using Javascript.
  • Backend servers: The event occurs independently of the user action on either the website or app. For example, automatic subscription renewal 

This guide explains how to bridge the gap between the HTML view and the native view enabling you to record events in the HTML view by sending them to the app. 

 Example

You have a hybrid app that offers subscriptions. You implement the subscription form in a web view which actually loads from your website.

You can record the subscription in-app event in the web view and send data related to it, like subscription type or price, to the native code.

The native code collects the data and uses AppsFlyer's SDK to send the subscription in-app event.

Recording in-app events in hybrid apps

In this guide we provide two methods for recording in-app events in hybrid apps:

Native javascript interface

The native javascript method is the recommended one. It uses the native javascript interface in order to establish communication between the HTML or web view and the native code.

This way you can send in-app event related data from the web view to the native code. Once the native code obtains the data it sends it to AppsFlyer using AppsFlyer's SDK.

URL loading method

In the url loading method, the native code listens to url loading events.

You can set the native code to listen to loading events of specific urls and extract data from the url parameters. The data is then is passed to AppsFlyer's SDK.

 

Was this article helpful?