Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose referrer #106

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/android/com/appsflyer/cordova/plugin/AppsFlyerPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ public boolean execute(final String action, JSONArray args, CallbackContext call
return onResume(args, callbackContext);
} else if ("getSdkVersion".equals(action)) {
return getSdkVersion(callbackContext);
} else if ("setSharingFilter".equals(action)) {
} else if ("getReferrer".equals(action)) {
return getReferrer(callbackContext);
}else if ("setSharingFilter".equals(action)) {
return setSharingFilter(args, callbackContext);
} else if ("setSharingFilterForAllPartners".equals(action)) {
return setSharingFilterForAllPartners(callbackContext);
Expand Down Expand Up @@ -753,6 +755,18 @@ private boolean getSdkVersion(CallbackContext callbackContext) {
}

/**
* Get the referrer
* @param callbackContext successCB: Success callback that returns the referrer url.
* @return
*/
private boolean getReferrer(CallbackContext callbackContext) {
final String referrer = AppsFlyerProperties.getInstance().getReferrer(this.cordova.getActivity().getApplicationContext());
final PluginResult result = new PluginResult(PluginResult.Status.OK, referrer == null ? "" : referrer);
callbackContext.sendPluginResult(result);
return true;
}

/**
* @param parameters Comma separated array of partners that need to be excluded
* @param callbackContext
*/
Expand Down
3 changes: 3 additions & 0 deletions www/appsflyer.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ if (!window.CustomEvent) {
exec(successCB, null, 'AppsFlyerPlugin', 'getSdkVersion', []);
};

AppsFlyer.prototype.getReferrer = function (successCB) {
exec(successCB, null, 'AppsFlyerPlugin', 'getReferrer', []);
};
/**
* Used by advertisers to exclude specified networks/integrated partners from getting data
* networks Comma separated array of partners that need to be excluded
Expand Down