Facebook makes it easy to learn how people are using App Links in your app. By understanding and analyzing trends about traffic and usage information with App Links, you can better understand the value of App Links and create better experiences for people.
Setup is only a few lines of code if you're using the Bolts SDK on iOS or Android. The Bolts SDK is included in the Facebook SDK. Results are available in Facebook's Insights Dashboard or through the insights endpoint of the Graph API. The events which you can measure are delievered as App Events. App Events are used to measure other types of events in your app as well, so you access the results through the general App Events framework.
These are the App Links-related events that can be generated by the Bolts SDK:
al_nav_in
.al_nav_out
.al_ref_back_out
.Each App Event can include extra fields that give more data about the event:
al_nav_out
& al_ref_back_out
- al_nav_in
-In order to use the functionality included in the Facebook SDK you must:
Update the Bolts Framework, as mentioned above.
The Facebook SDK will automatically be initialized when the UIApplicationDidFinishLaunchingNotification
event is sent to your app.
To generate an event when handling an incoming link, we've provided an example you can use in your app's application delegate to parse incoming links. The [BFURL URLWithInboundURL:url sourceApplication:sourceApplication]
method will generate an App Event if the incoming URL is an App Link event.
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { BFURL *parsedUrl = [BFURL URLWithInboundURL:url sourceApplication:sourceApplication]; if (parsedUrl.appLinkData) { // This is AppLink traffic NSURL *applinkTargetUrl = parsedUrl.targetURL; } else { // Not an Applink URL, handle differently } }
Update the Bolts Framework, as mentioned above.
Use the following function to parse inbound URLs:
AppLinks.getTargetUrlFromInboundIntent(Context, Intent);
The Facebook SDK needs to be initialized before getTargetUrlFromInboundIntent
is called in order to register the App Links event listener before the App Links events are sent.
Here's some sample code you can use in your base activity:
onCreate() { Settings.sdkInitialize(this); Uri applinkTargetUrl = AppLinks.getTargetUrlFromInboundIntent(this, getIntent()); if (applinkTargetUrl != null) { // This is an AppLink URL, handle it in your app } // Your code }
Navigating to outbound App Links is automatically reported as an App Event as long as you're using version 3.17.1 (iOS) / 3.17.2 (Android) or later of the Facebook SDK, and you're using the matching Bolts SDK.
App Links events data can be accessed by either the Graph API or browsing App Insights.
Learn more about setting up events for app launch for iOS and Android.
App Launch Event and TimeSpent Event have new “sourceApplication” parameters for these two events, so that the breakdown by different sources for launches can be visible by using “sourceApplication” as an Extra Filter.
App Launch Event:
https://www.facebook.com/insights/<YOUR-APP-ID>?section=AppEvents&event_name=fb_mobile_activate_app&card=breakdown_table
App Time Spent Event:
https://www.facebook.com/insights/<YOUR-APP-ID>?section=AppEvents&event_name=fb_mobile_deactivate_app&card=breakdown_table
The three events will be added with a prefix of “bf_” (meaning they are forwarded from Bolts Framework) in App Events. You can understand the makeup of users engaging with your app including age, gender, language and country.
App Insights:
Navigate In:
https://www.facebook.com/insights/<YOUR-APP-ID>?section=AppEvents&event_name=bf_al_nav_in
Navigate Out:
https://www.facebook.com/insights/<YOUR-APP-ID>?section=AppEvents&event_name=bf_al_nav_out
Navigate Back to Referer:
https://www.facebook.com/insights/<YOUR-APP-ID>?section=AppEvents&event_name=bf_al_ref_back_out
Graph API:
You can also fetch this data via Graph Insights API:
http://graph.facebook.com/v2.1/app_insights/app_event/?event_name=bf_al_nav_in&aggregateBy=COUNT&since=<STARTTIME>&until=<ENDTIME>&access_token=<YOUR-ACCESS-TOKEN>
http://graph.facebook.com/v2.1/app_insights/app_event/?event_name=bf_al_nav_in&aggregateBy=COUNT&since=<STARTTIME>&until=<ENDTIME>&breakdowns[0]=client&access_token=<YOUR-ACCESS-TOKEN>&date_format=U
http://graph.facebook.com/v2.1/app_insights/app_event/?event_name=fb_mobile_activate_app&breakdowns[0]=souceApplication&aggregateBy=COUNT&since=&until=&breakdowns[0]=client&access_token=&date_format=U