搜索插件、代码仓与 APP 分类

插件详情v3.1.0

flutter_facebook_app_links

一个 Flutter 插件,使用 FB App Links SDK 捕获来自 Facebook 广告的延迟深度链接。

AndroidiOS
近 30 天下载
2900
喜欢数
41
Pub 分数
140

安装插件

flutter pub add flutter_facebook_app_links

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

一个 Flutter 插件,可让应用通过 Facebook App Links SDK 接收并处理来自 Facebook 广告的延迟深度链接。该插件使开发者能够追踪用户从 Facebook 营销活动中的互动行为,并在应用未预先安装的情况下,将用户引导至应用内的特定内容。该插件可在 Android 和 iOS 平台上运行,确保与 Facebook 的归因和深度链接基础设施无缝集成。

适合场景

  • 处理 Facebook 广告点击重定向
  • 通过深度链接跟踪广告系列表现
  • 启用安装后深度链接
  • 通过定向广告支持重新参与
  • 促进个性化用户体验

主要特点

  • 延迟深度链接支持
  • Facebook 应用链接 SDK 集成
  • 跨平台(Android 和 iOS)
  • 用于链接处理的简单 API
  • 应用启动时自动捕获链接

适合对象

  • 使用 Facebook 广告的营销团队
  • 需要活动归因的应用
  • 开发用于推荐或入职流程的开发者
  • 具有动态内容定位的产品
  • 专注于用户获取的移动应用

使用建议

  • 需要在 Facebook 开发者控制台中设置 Facebook App Links
  • 需要正确的 URL 方案和应用链接配置
  • 某些设备可能需要额外的权限
  • 仅限 Facebook 广告来源
  • 依赖于 Facebook SDK 版本兼容性

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Flutter Facebook App Links

Flutter plugin for Facebook App Links SDK. This plugin must be used to catch deferred deeplinks sent from Facebook after your app has been installed from a FB ADS.

Getting Started

First of all, if you don't have one already, you must first create an app at Facebook developers: https://developers.facebook.com/

Get your app id (referred to as [APP_ID] below)

Configure Android

For Android configuration, you can follow the same instructions of the Flutter Facebook App Events plugin: Read through the "Getting Started with App Events for Android" tutuorial and in particular, follow step 2 by adding the following into /app/res/values/strings.xml (or into respective debug or release build flavor)

configure inside android/app/main/res/values/strings.xml the above values (without square brackets):

<string name="facebook_app_id">[your_app_id]</string>
<string name="facebook_client_token">[your_client_token]</string>

then, add that string resource reference to your main AndroidManifest.xml file, within ...

<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id" />
<meta-data android:name="com.facebook.sdk.ClientToken" android:value="@string/facebook_client_token"/>
Configure iOS

For iOS configuration, you can follow the same instructions of the Flutter Facebook App Events plugin: Read through the "Getting Started with App Events for iOS" tutuorial and in particular, follow step 4 by opening info.plist "As Source Code" and add the following

  • If your code does not have CFBundleURLTypes, add the following just before the final </dict> element:
<key>CFBundleURLTypes</key>
<array>
  <dict>
  <key>CFBundleURLSchemes</key>
  <array>
    <string>fb[APP_ID]</string>
  </array>
  </dict>
</array>
<key>FacebookAppID</key>
<string>[APP_ID]</string>
<key>FacebookDisplayName</key>
<string>[APP_NAME]</string>
  • If your code already contains CFBundleURLTypes, insert the following:
<array>
 <dict>
 <key>CFBundleURLSchemes</key>
 <array>
   <string>fb[APP_ID]</string>
 </array>
 </dict>
</array>
<key>FacebookAppID</key>
<string>[APP_ID]</string>
<key>FacebookDisplayName</key>
<string>[APP_NAME]</string>

## How to use

import 'dart:io' show Platform;
...
...
/// FB Deferred Deeplinks
void initFBDeferredDeeplinks() async {

  String deepLinkUrl;
  // Platform messages may fail, so we use a try/catch PlatformException.
  try {

    deepLinkUrl = await FlutterFacebookAppLinks.initFBLinks();
    if(Platform.isIOS)
      deepLinkUrl = await FlutterFacebookAppLinks.getDeepLink();

    /// do what you need with the deeplink...
    /// ...
  }catche(e){
    /// in case of error...
  }
}

About Facebook App Links

Please refer to the official SDK documentation for Android and iOS.

IMPORTANT NOTES

User privacy [DO NOT IGNORE]

How documented on Facebook docs, starting from v5.0.0 of the SDK, they introduce a flag for disabling automatic SDK initialization to be GDPR compliant. It means that you should collect user consent before you use call the method initFBLinks() of this plugin and save the user choice. Moreover, you should give the user a chance to revoke their consent in the future. Please keep in mind that this plugin uses FacebookSDK.setAutoInitEnabled(true) in Android and Settings.isAutoInitEnabled = true in iOS by default, so the consent must be granted in your Dart code before you call FlutterFacebookAppLinks.initFBLinks().

Testing deferred deep links

To correctly test deferred deeplinks, DO NOT use the preview of your FB ADS campaign. Instead, use this tool APP ADS HELPER

At the end of the page you will find a "Test deep link" button, click on it and type your custom url scheme (deeplink), for example: myawesomeapp://screen/login

Select the second checkbox (or both). Remember that to make it works, you'll need the Facebook app installed on your device (Android or iPhone) and you must be logged in with the same account you're using in the Facebook Developers console.

Your app doesn't need to be published on the store, simply uninstall it and re-install using Android Studio/VSCode or XCode after you've sent the deferred deep link.

所属分类

源码仓库

使用此插件的项目

暂无相关数据。