In-app events for hybrid apps

At a glance: Record in-app events of users who have your app installed, but perform an event on your mobile website, and not the app.

In-app events for hybrid apps

In-app events that occur within the app are reported using the SDK. What about events that occur outside the app?

There are a few scenarios in which events occur outside the app context:

  • Events that take 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. 
  • Backend servers: Events occur independently of user action on either the website or app. For example, automatic subscription renewal
  • 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.

This guide regards the hybrid scenario. Learn how to bridge the gap between the HTML view and native views, enabling you to record events in the HTML view and send 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 the AppsFlyer 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 the 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 passed to the SDK.

Was this article helpful?