image

Mogua Flutter Plugin

Pub Package

Mogua is a web to app parameter passing solution. It allows you to track your app's installations from landing page with a lightweight deferred deep linking SDK.

Try our live demo in 10 seconds!


Features

✅ Track your apps’ installation (Deferred Deep Linking)

✅ Track your apps’ opening events (e.g., from URL Scheme, Universal Link, App Links)

✅ Pass parameters via deep links

✅ Parameter analytics

✅ App trending analytics


Install the plugin

Through the command line:

dart pub add mogua

Alternatively, in the dependencies: section of your pubspec.yaml, add:

dependencies:
  # ...
  mogua: ^1.0.0


Initialize the plugin

You need to initialize the plugin before any usage.

The init method returns a Future to indicate whether the initialization is complete.

import 'package:mogua/mogua.dart';

// appKey: The App Key associated with this application, you can find it on the mogua.io dashboard.
// allowPasteboardAccess: Whether to allow access to the clipboard. Enabling this feature can enhance accuracy, but may trigger permission warnings on certain systems.

Mogua.init(appKey: '${appKey}', allowClipboardAccess: true).then((_) {
	// You can invoke Mogua.getInstallData here.
});


Retrieve the params

Before retrieving the params, refer to the How to collect params on website.

Get params during app installation (Deferred Deep Linking)

After initialization, you can asynchronously retrieve the parameters passed during installation (eg. submissions from landing pages):

Mogua.getInstallData().then((data) {
  // data: Parameters passed from the web to the app.
  // Returns an empty Map if no parameters are provided.
  // Parameters are cached and will remain the same unless the app is reinstalled.
}).onError((error, stackTrace) {
  // Handle any exceptions that occurred.
});

Get params during app opening (Direct Deep Linking)

When the app is already installed on the device, there is no need to download and launch the app again. Instead, we simply open the app and pass the parameters collected.

Mogua.getOpenData(
  onData: (data) {
    // Handle the retrieved data.
  },
  onError: (error) {
    // Handle the exception.
  },
)


Remember to configure the URL Scheme in your application.

A detailed guide is available on the mogua.io dashboard.