flutter_meta_appads_sdk 1.1.1 copy "flutter_meta_appads_sdk: ^1.1.1" to clipboard
flutter_meta_appads_sdk: ^1.1.1 copied to clipboard

This Flutter plugin provides a simple interface to interact with the Meta SDK. It allows you to initialize the SDK, set user data (Advanced Attribution), and log events/purchases.

flutter_meta_appads_sdk #

This Flutter plugin provides a simple interface to interact with the Meta SDK. It allows you to initialize the SDK, set user data, log standard events, log purchases, and log custom events.

Installation #

You must first create an app at Facebook developers: https://developers.facebook.com/

Get your app id and client token from Meta Developers Panel.The following are the main steps for integration. Please use these as a reference and always consult the official documentation for iOS integration and Android Integration

iOS install

  1. Add this snippet to your Info.plist and replace [APP-ID], [CLIENT-TOKEN], and [APP-NAME] with the appropriate values extracted from the Meta panel.
<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>FacebookClientToken</key>
<string>[CLIENT-TOKEN]</string>
<key>FacebookDisplayName</key>
<string>[APP-NAME]</string>
  1. Set the following code to true or false in your Info.plist to enable or disable automatic SDK events, respectively.
<key>FacebookAutoLogAppEventsEnabled</key>
<false/>
  1. Decide whether you want to disable advertiser identifier tracking by adding this to your Info.plist. Remember, you can later change this setting using the SDK, but having it disabled by default helps you obtain user consent before sending IDs.
<key>FacebookAdvertiserIDCollectionEnabled</key>
<false/>

Android Install

  1. Add the following meta-data elements within the application element in your android/app/src/main/AndroidManifest.xml file to specify your app ID and client access ID:
<application android:label="string/app_name">
    ...
    <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"/>
    ...
</application>
  1. Add uses-permision INTERNET in android/app/src/main/AndroidManifest.xml
...
    </application>

    <uses-permission android:name="android.permission.INTERNET"/>
...
  1. Add strings.xml to your Android app in android/app/src/main/res/values/strings.xml replacing [APP-ID] and [CLIENT-TOKEN] with the appropriate values extracted from the Meta panel.
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="facebook_app_id">[APP-ID]</string>
    <string name="facebook_client_token">[CLIENT-TOKEN]</string>
</resources>
  1. Set the following code to true or false in your android/app/src/main/AndroidManifest.xml to enable or disable automatic SDK events, respectively.
<application>
  ...
  <meta-data android:name="com.facebook.sdk.AutoLogAppEventsEnabled"
           android:value="false"/>
  ...
</application>
  1. Decide if your SDK will start on app startup or via initSdk() method adding the following code to your android/app/src/main/AndroidManifest.xml (having it disabled by default helps you obtain user consent before sending):
<application>
  ...
  <meta-data android:name="com.facebook.sdk.AutoInitEnabled"
           android:value="false"/>
  ...
</application>
  1. Decide whether you want to disable advertiser identifier tracking by adding this to your android/app/src/main/AndroidManifest.xml. Remember, you can later change this setting using the SDK, but having it disabled by default helps you obtain user consent before sending IDs.
<application>
  ...
  <meta-data android:name="com.facebook.sdk.AdvertiserIDCollectionEnabled"
           android:value="false"/>
  ...
</application>

Key features #

  • Initialization: initSdk() sets up the SDK.
  • User Data: setUserData(FBSetUserDataCommand) provides user information for targeted ads.
  • Event Tracking:
    • logStandardEvent(FBLogStandardEventCommand): Tracks standard events (e.g., level up).
    • logPurchase(FBLogPurchaseCommand): Records purchase events.
    • logEvents(FBLogEventCommand): Logs custom events.
  • Anonymous ID: getFbAnonId() retrieves the Facebook Anonymous ID.
  • Tracking permissions:
    • setAdvertiserTrackingEnabled(bool): This function enables or disables advertiser tracking, controlling whether your app shares user data with Meta for targeted advertising purposes.
    • setAdvertiserIDCollectionEnabled(bool): Only for iOS (lower than iOS 17) Use with ATT permissions request, set to True when user allows and False when disallows.
    • setDataProcessingOptions(FBSetDataProcessingOptionsCommand): This function allows you to configure various data processing options, including data usage and sharing preferences, for the Meta App Ads SDK. Refer to Meta Documentation

About Meta SDK #

Follow the official Meta SDK guide for correct integration: Meta App Ads URL . Please report an issue if you find anything is not working according to official documentation.

5
likes
150
points
180
downloads

Publisher

verified publishersergio.durban.cat

Weekly Downloads

This Flutter plugin provides a simple interface to interact with the Meta SDK. It allows you to initialize the SDK, set user data (Advanced Attribution), and log events/purchases.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter, plugin_platform_interface, protobuf

More

Packages that depend on flutter_meta_appads_sdk