FB.GetAppLink

Tells you the URI at which the app was accessed. On Web it will be the URL of the page that the game is contained on. When on iOS or Android, it's the URL with which the app was invoked, using the schema that the app is registered to handle.

Additional changes to your native project are necessary to implement Deep Linking. Please read the Best Practices.

You must enable the 'Deep Linking' option in your App's Facebook settings.

Parameters

public static void GetAppLink(
    FacebookDelegate<IAppLinkResult> callback
)
NameTypeDescriptionDefault

callback

FacebookDelegate <IAppLinkResult>

A delegate which will receive the result of the method call

none

Example

See if the user came into your app by interacting with a request.

FB.GetAppLink(DeepLinkCallback);

void DeepLinkCallback(IAppLinkResult result) {
    if(!String.IsNullOrEmpty(result.Url)) {
        var index = (new Uri(result.Url)).Query.IndexOf("request_ids");
        if(index != -1) {
            // ...have the user interact with the friend who sent the request,
            // perhaps by showing them the gift they were given, taking them
            // to their turn in the game with that friend, etc.
        }
    }
}

Best Practices

Deep linking allow your app to know the context in which is was invoked and immediately present the user with content that they expect to see. For instance, when someone clicks on a Request sent by your app on Facebook Canvas, they'll be taken to your app's URL, but with a parameter called request_ids appended. The value of that parameter will be the IDs of any requests the user interacted with to get to your app. Assuming you've set the 'Deep Linking' option in your iOS and/or Android app configuration on our developer site, the same will be true of users who interact with requests on the browser or native Facebook app on those platforms.

If you append a tracking parameter to your Feed stories, you can look for that in the deep link query and deal with it in the same way; similarly, you can look for Open Graph action IDs, ad campaign tracking parameters, and so on.

Please see our platform-specific documentation for Android and iOS deep linking for more details.