In-App Events for Hybrid Apps

Introduction

Hybrid apps combine native views and HTML content. If you have a hybrid app, you can track in-app events by calling AppsFlyer's SDK API using Javascript.

This guide explains how to bridge the gap between the HTML view and the native view, effectively allowing you to track in-app events from HTML or web view.

 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 track the subscription in-app event in the web view and send data related to it (such as type of subscription, price etc.) to the native code.

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

Tracking In-App Events in Hybrid Apps

In this guide we provide two methods for tracking 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?
1 out of 3 found this helpful