User invite attribution

At a glance: Attribute and record new installs originating from existing users inviting their friends to use your apps.


 iOS 14 updates

User invite attribution doesn't use IDFA, so iOS 14 does not impact it in any way.

User invite attribution is free of charge to all account plans.

User-invite attribution overview

Why is user-invite attribution useful?

  • Obtain information about the best-referring users:
    Users that refer their friends to your app are high-value engaged users, which you may want to preserve, retarget, or incentivize.
  • Use the referring user information to personalize the first time experience for the new user:
    Instead of a general welcome message, you could have a personalized message, which engages the new user much more. For example: "Welcome, John! Join your friend Marsha in an epic battle after you finish the tutorial".
  • Know the cost and ROI of user invites for better results:
    Are user invites free of charge? Not really. They use up your app's advertising "real estate", which could alternately get you ad-generated revenue. Do user invites get you positive ROI, compared with the alternative? In some cases they do, and in others, they don't.

You can use AppsFlyer's cost parameters to assign cost to user invite installs, based on the alternatives.


A banner gains you $5 RPM with ad views (here's a great way to measure it). On average, with a 2% conversion rate of views to invites, and with a 10% conversion rate of invites to installs, you get 2 new users from every 1K views. Therefore, using the same banner space to promote invites costs 5$/2=$2.5 per install. Add af_cost_value=2.5 value to reflect this cost on the dashboard.

Combined with your revenue reporting in-app events, you're able to see which user invite campaigns give you the best or worst results, and which invite channels are best for your purposes.

How does attributing user invites work?

Installs attributed to an invite link appear on the dashboard under the media source af_app_invites.

The channels used to send the invites through email, SMS, Facebook, etc., appear under the Channel grouping under the media source af_app_invites.


Selecting af_app_invites media source, and grouping by Channel, displays clicks and installs from user invites that went through Gmail and Facebook

Developer's guide

Setting OneLink

Invite attribution uses OneLink to redirect the invited user to the relevant app store. OneLink also allows you to use deferred deep linking. Deferred deep linking opens a specific activity when the user launches the app. It also sets customized content to keep the user in the context of installing after an invite.

Make sure to configure OneLink correctly for your app:

  • Configure OneLink redirections
  • Follow the guide on how to set up deferred deep linking - setting up deferred deep linking gives the data that you need to programmatically send users to specific activities, or reward both the inviter and invitee.
  • Optional - Configure OneLink deep linking - you don't have to configure OneLink deep linking but it could be helpful in certain scenarios. For example:
    • You set up a campaign where users invite their friends to install the app. Both get credit points to use in the app. If the invitee installs the app, the inviter gets 50 credit points and the invitee gets 100 credit points. If the invitee already has the app installed, the inviter gets 25 credit points and the invitee gets 50 credit points. To distinguish between the two cases, use deferred deep linking for the first and deep linking for the second.

Once the OneLink is fully configured, take the relevant OneLink template ID.

Before calling start in your app, set the OneLink which is invoked according to the OneLink template ID (OPSz in this example):



Make sure the correct OneLink template ID is used. Otherwise, the created attribution link is broken.

Android iOS Unity V4

Generating the link

On Android, make sure to import the following libs:

import com.appsflyer.share.ShareInviteHelper;
import com.appsflyer.share.LinkGenerator;

The LinkGenerator class builds the invite URL according to various setter methods which allow passing on additional information on the click. This information is available through onConversionDataSuccess when the new user accepts the invite and installs the app. In addition, campaign and channel parameters are visible in the AppsFlyer Dashboard.

SDK-generated invite links have a TTL of 180 days.

If for some reason the API can't be reached, LinkGenerator returns a long link.

Android iOS Objective-C iOS Swift Unity V4
LinkGenerator linkGenerator = ShareInviteHelper.generateInviteUrl(MainActivity.this);
// optional - set a brand domain to the user invite link
CreateOneLinkHttpTask.ResponseListener listener = new CreateOneLinkHttpTask.ResponseListener() {
	public void onResponse(String s) {
		Log.d("Invite Link", s);
    // write logic to let user share the invite link

	public void onResponseError(String s) {
		// handle response error
linkGenerator.generateLink(MainActivity.this, listener);


  • onResponse and onResponseError are callback methods for generating OneLink URLs. They are part of the CreateOneLinkHttpTask.ResponseListener interface and must be implemented. They are used to generate invite links that you can put in various views in the application.
  • You can add any of these attribution link parameters to the generated link.
  • Special characters in parameter values need to be encoded when passed to the LinkGenerator function.

All link generator setters

Android iOS
API Name Description Usage

setChannel(String channel)

The channel through which the invite was sent (e.g. Facebook/Gmail/etc.)


setCampaign(String campaign)

A campaign name


setReferrerName(String referrerName)

The name of the referring user


setReferrerImageURL(String referrerImageURL)

The URL to referrer user avatar


setReferrerCustomerId(String referrerCustomerID)

Set the customer_user_id of referrer user


addParameter(String key, String value)

A single key value custom parameter


addParameters(Map<String, String> parameters)

Multiple key value custom parameters


setBrandDomain(String domain)

The name of the brand domain


Requires creating branded links

Recording sender invites

It is recommended to generate an in-app event after the invite is sent to record the invites from the senders' perspective. This enables you to find users who tend to invite friends and the media sources that get you these users.

You can send a regular in-app event or use logInvite method instead. logInvite is a ready-made in-app event encapsulated in an API for easier use.

Android iOS
ShareInviteHelper.logInvite(context, channel, additionalParametersForTheEvent_optional);

Retrieving attribution data after invited user install

All the parameters passed in the link generator are available by calling onConversionDataSuccess. This allows you to retrieve the relevant parameters (such as referrer name and avatar URL) and personalize the first-time experience for the new user. This is an example of the attribution data returned by onConversionDataSuccess:

	"attribute": "is_first_launch" = "true"
	"attribute": "click_time" = "2019-04-04 08:33:05.668"
	"attribute": "af_referrer_customer_id" = "CUSTOMER_USER_ID"
	"attribute": "shortlink" = "12a3b456"
	"attribute": "af_referrer_uid" = "1234567890123-4567890123456789012"
	"attribute": "af_siteid" = ""
	"attribute": "install_time" = "2019-04-04 08:33:45.286"
	"attribute": "cost_cents_USD" = "0"
	"attribute": "campaign" = "None"
	"attribute": "af_click_lookback" = "7d"
	"attribute": "orig_cost" = "0.0"
	"attribute": "af_status" = "Non-organic"
	"attribute": "iscache" = "true"
	"attribute": "media_source" = "af_app_invites"

More information about using conversion data: iOS and Android.

Using user invite links for re-engagement

You can use user invite links for re-engagement. However, you need to make sure that the invited user has the app installed. If a user who doesn't have the app gets a user invite links and installs the app, a click appears in the retargeting dashboard, but the install appears in the overview dashboard.

To use user invite links for re-engagement, add the parameter is_retargeting and set it to true using the addParameter method:

Android iOS Unity V4
linkGenerator.addParameter("is_retargeting", "true");

Rewarding user invites

You can reward users who invite their friends to install your app. By rewarding, you encourage users to invite their friends. This is a great way to expand your user base and boost your revenue.

When to reward

You can reward users when their friends install your app after being invited. You can also reward users when their friends perform some in-app event, like a purchase in your app.

Reward users on install

When an invited user installs the app, the ID of the referring user is found in the conversion data in the SDK:

  • af_referrer_uid - is the AppsFlyer ID of the user who sends the invite
  • af_referrer_customer_id - is the customer user ID of the user who sends the invite. Only appears in the conversion data if you set the customer user ID for this user.

Use referrer ID to reward on install

Jenny invites Nivi to install your app.

  1. When Nivi launches the app, the app fetches Jenny's referrer ID
  2. The app sends the referrer ID to your backend
  3. In your backend, add Jenny's referrer ID to a list of users to be rewarded
  4. When Jenny launches her app, check if her referrer ID is on the list of users to be rewarded
  5. If it is, reward her

Reward users on in-app event

If you want to generate revenue through user invites, rather than just acquire users, you can reward in-app events. In this case, you only reward referring users when the invited user performs an in-app event like a purchase or subscription.

The process of rewarding in-app event

Jenny invites Nivi to install your app.

Set af_sub1 on The Invite Link

  1. When Jenny invites Nivi, generate an invite link
  2. In the invite link, put a parameter af_sub1=<JENNY_USER_ID>

Nivi installs the app and makes a purchase. When he makes a purchase, an in-app event is sent to AppsFlyer. This in-app event has sub1=<JENNY_USER_ID> associated with it.

Use af_sub1 to Update The List of Users to be Rewarded

  1. Pull in-app event data using pull API or get in-app event data from push API
  2. In the data, look for events that have af_app_invites as the media source
  3. Such events have af_sub1 associated with them that contains the referrer ID
  4. Store referrer IDs in the list of users to be rewarded

Reward Jenny

  1. When Jenny launches her app, check if her referrer ID is in the list of users to be rewarded
  2. If it is, reward her

Custom dashboard views

Below are the available views of the Custom Dashboard that show user invite information:




Limitation Description
SDK version Must have AppsFlyer SDK version 4.8.0+ and Unity SDK version 4.17.0+.
Social media apps landing page Link generated from user invites can't implement social media apps landing pages.


Was this article helpful?