Giter VIP home page Giter VIP logo

android-referrer-plugin's Introduction

android-referrer-plugin

This plugin captures the referrer value passed when an android app is installed from a webpage and stores it in the applications shared preferences for later retrieval.

You'll typically want to use the AppPreferences plugin to pull the referrer value into your phonegap app for your javascript code to manipulate.

Purpose

This plugin lets your app display different behavior based on where it was installed from. If you have a sports app, for example, and want to use the same codebase, but brand the app differently for different teams, you can use this plugin to capture whether the app was installed from the Denver Broncos or Washington Redskins page, and skin the app appropriately.

Don't forget when using this plugin that if an app is installed directly from Google Play, this plugin will not execute--the intent will never fire.

Install

This plugin uses plugman

cordova plugins add https://github.com/8zrealestate/android-referrer-plugin

Usage

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

http://market.android.com/details?id=com.yourid.here&referrer=textinreferrer
market://details?id=com.yourid.here&referrer=textinreferrer

The value in the referrer text (textinreferrer above) will be stored as a string in your apps shared preferences object, under the key referrer.

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 here>/com.eightz.mobile.cordova.plugin.android.referrer.Receiver \
--es "referrer" "textinreferrer"

Limits

  • I don't know how long a referrer string can be.
  • I believe the referrer string can contain any characters that are valid in URL query strings, but don't think that ampersands are allowed. For example: &referrer=foo&bar would result in a captured referrer of foo
  • If you are trying to be compatible with the app-argument text in Apple smart banners, be aware that app-argument text block is required to be a url.

android-referrer-plugin's People

Contributors

mooreds avatar tvhnet2014 avatar

Watchers

thetazzbot avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.