referrer 0.0.1 copy "referrer: ^0.0.1" to clipboard
referrer: ^0.0.1 copied to clipboard

A plugin to read various referrer information

Referrer #

This is a plugin which allows you to read various referrer information.

A referrer is the URL of the webpage (or app) that caused the app to be opened via a deep link.

Most APIs are subject to various platform limitations and they're subject to the referrer policy of the webpage. Therefore, all information read via the APIs of this plugin may not be available due to various reasons.

iOS #

On iOS this works by reading NSUserActivity#referrerUrl.

Android #

On Android this reads Intent.EXTRA_REFERRER of the last incoming intent. Related Activity#getReferrer().

It's up to the browser and the webpage's referrer policy to supply a value. On Android, the referrer can also contain the name of the application that startet the app. This means this can not just include the URL, but also other applications.

In general, Chrome does a good job of supplying the referrer information. The referrer is mostly not available when opening a deeplink via Firefox.

How to use this? #

Here's some examples where it may make sense to read the referrer information.

class ReferrerObserver with WidgetsBindingObserver {

  @override  
  Future<bool> didPushRouteInformation(RouteInformation routeInformation) async {
    final referrerInfo = await Referrer().getReferrer();
    // do something with referrerInfo
    return false;
  }
}

// Add the observer somewhere
WidgetsBinding.addObserver(ReferrerObserver())
final _appLinks = AppLinks();

_appLinks.uriLinkStream.listen((uri) async {
    final referrerInfo = await Referrer().getReferrer();
    // do something with referrerInfo
});

Install referrer #

This library does not offer tracking of the install referrer. However, there are various other packages that can read the install referrer.

21
likes
0
pub points
84%
popularity

Publisher

verified publisheruekoetter.dev

A plugin to read various referrer information

Homepage

License

unknown (license)

Dependencies

flutter

More

Packages that depend on referrer