提问人:Adnane ROUHI 提问时间:6/9/2023 最后编辑:FedorAdnane ROUHI 更新时间:9/27/2023 访问量:167
当我在 Facebook 上为我的 flutter 应用创建广告时,如何跟踪安装量?
How can i track installs number when I create an ad on facebook for my flutter app?
问:
我创建了一个 flutter 应用程序并发布到 Play 商店,我通过支付广告费用在 Facebook 上推广该应用程序。问题是Facebook无法跟踪安装数量,所以我只做一个普通的广告。 如何集成Facebook SDK来跟踪FaceBBOK ADS的安装。请需要您的帮助...
import 'package:flutter_facebook_sdk/flutter_facebook_sdk.dart';
class MyAppState extends State<MyApp> {
String _deepLinkUrl = 'Unknown';
FlutterFacebookSdk? facebookDeepLinks;
Future<void> initPlatformState() async {
String? deepLinkUrl;
try {
facebookDeepLinks = FlutterFacebookSdk();
facebookDeepLinks!.onDeepLinkReceived!.listen((event) {
setState(() {
_deepLinkUrl = event;
});
});
deepLinkUrl = await facebookDeepLinks!.getDeepLinkUrl;
setState(() {
_deepLinkUrl = deepLinkUrl!;
});
} on PlatformException {}
if (!mounted) return;
}
@override
void initState() {
super.initState();
initPlatformState();
}
Future<void> setAdvertiserTracking() async {
await facebookDeepLinks!.setAdvertiserTracking(isEnabled: true);
}
@override
Widget build(BuildContext context) {
return Observer(
builder: (_) => MaterialApp(
debugShowCheckedModeBanner: false,
navigatorKey: navigatorKey,
navigatorObservers: [
FirebaseAnalyticsObserver(analytics: analytics),
],
home: SplashScreen(),
theme: AppTheme.lightTheme,
darkTheme: AppTheme.darkTheme,
themeMode: appStore.isDarkMode ? ThemeMode.dark : ThemeMode.light,
scrollBehavior: SBehavior(),
supportedLocales: LanguageDataModel.languageLocales(),
localizationsDelegates: [AppLocalizations.delegate,
GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate],
localeResolutionCallback: (locale, supportedLocales) => locale,
locale: Locale(appStore.selectedLanguage!.languageCode.validate(value:
DEFAULT_LANGUAGE)),
),
);
}
}
`
答:
0赞
LucaRoverelli
9/27/2023
#1
您应该在应用中集成 Facebook 应用事件库:
https://pub.dev/packages/facebook_app_events
此外,您可以在 Facebook 文档页面上找到其他有用的信息: https://developers.facebook.com/docs/app-ads/measuring/installs-and-in-app-conversions/
评论