0.1.5 • Published 5 years ago

cordova-install-referrer v0.1.5

Weekly downloads
12
License
ISC
Repository
github
Last release
5 years ago

Cordova Install Referrer

This plugin captures the referrer value passed when an android app is installed from a webpage.

Install

cordova plugins add cordova-install-referrer

Usage

To use this plugin, add &referrer=xyz to app install links on your webpages. For example:

https://play.google.com/store/apps/details?id=your.package.id&referrer=referrer-value

API

// Callback style
cordova.plugins.referrer.get(success, error);

// Promise style
let promise = cordova.plugins.referrer.get();

Example

// Callback style
cordova.plugins.referrer.get((referrer) => {
    console.log(referrer);
}, (error) => {
    console.error(error);
});

// Promise style
cordova.plugins.referrer.get().then((referrer) => {
    console.log(referrer);
}).catch((error) => {
    console.error(error);
});

Testing

To test that the install referrer event is received by the plugin in your emulator:

run adb shell and then

am broadcast -a com.android.vending.INSTALL_REFERRER \
-n <your.package.id>/com.sdofeen.cordova.plugins.referrer.Receiver \
--es "referrer" "referrer-value"