Codeless App Events

Codeless App Events is a feature of the Facebook SDK that allows you to quickly and easily track any user in-app actions without implementing codes or releasing a new version of your app. Instead, you can use a simple visual set-up tool to define event names for any elements of the app screens such as buttons, images or links. As your users navigate through the app and interact with these UI elements, events will be sent to Facebook. This tool can be accessed from Facebook's Events Manager.

To use this tool, your app will need to be integrated with Facebook SDK v4.34 or above. Beginning from this version, the FB SDK will contain the 'Marketing Kit' to enable codeless app events. Please follow the instructions below.

iOS Integration

  • If your app has never installed Facebook SDK, please visit the Getting Started with App Events for iOS page to get instructions for how to integrate your app with the latest version of the iOS SDK.
  • If your app is already integrated with the Facebook iOS SDK, you will need to add the Marketing kit separately.

Using Cocoapods

  1. In your Podfile, add:
    pod 'FBSDKMarketingKit'
  2. Run pod install or pod install --repo-update

  3. Insert the following lines in your project info.plist file before the </dict> element:
    <key>FacebookAppID</key>
    <string>your-app-id</string>
    <key>FacebookDisplayName</key>
    <string>your-app-name</string>
  4. Build your Project
  5. Verify your Integration

    Turn on Codeless debug event logging by opening the application's .plist as code in Xcode and add the following XML to the property dictionary:

    <key>FacebookCodelessDebugLogEnabled</key>
    <true/>

    Then go to App Ads Helper.

    • Select an App and click Submit.
    • Go to the bottom and choose App Events Tester
    • If your app is sending fb_codeless_debug events, they will be listed in the table.

Android Integration

  • If your app has never installed Facebook SDK, please visit the Getting Started with App Events for Android page to get instructions for how to integrate your app with the latest version of Android SDK.
  • If your app is already integrated with the Facebook Android SDK, you will need to upgrade to the latest FB Android SDK version.

Using Maven

  1. In the buildscript { repositories {}} section of the build.gradle (Project) file, add:

    mavenCentral()
  2. Add the following to the dependencies {} section of your build.gradle (module: app) file to compile the latest version of the Facebook SDK, which includes Marketing Kit.

    implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
    • If you only have the Facebook Core Android SDK, you will need to upgrade to the latest version of the Core SDK:
      implementation 'com.facebook.android:facebook-core:[4,5)'
      Then, add the following line to integrate the Marketing Kit separately:
      implementation 'com.facebook.android:facebook-marketing:[4,5)'
  3. Add a meta-data element to the application element:
    <application android:label="@string/app_name" ...>;
      ...
      <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
      ...
    </application>
  4. Build your project.
  5. Verify your Integration

    Turn on Codeless debug event by adding the following lines in AndroidManifest.xml:

    <meta-data
        android:name="com.facebook.sdk.CodelessDebugLogEnabled"
        android:value="true" />

    Then go to App Ads Helper.

    • Select an App and click Submit.
    • Go to the bottom and choose App Events Tester
    • If your app is sending fb_codeless_debug events, they will be listed in the table.
    Note: Only works for Facebook SDK v4.35 and above.

FAQ

GENERAL

1. How can I check whether Marketing Kit is integrated correctly?

A few minutes after you have launched your app on your test device, you will see events with the name fb_codeless_debug in the Events Manager or Facebook Analytics.


iOS

1. What do I do if I see the following warning:
[!] Unable to find a specification for FBSDKMarketingKit
Run pod update then pod install --repo-update.

Android

1. What do I do if I see the following build error:
Android SDK build Error:Execution failed for task ':app:processDebugManifest'.> Manifest merger failed : 
Attribute activity#com.facebook.FacebookActivity@theme value=(@android:style/Theme.Translucent.NoTitleBar) 
from AndroidManifest.xml:69:13-72is also present at [com.facebook.android:facebook-android-sdk:4.16.0] 
AndroidManifest.xml:32:13-63 value=(@style/com_facebook_activity_theme).Suggestion: add
'tools:replace="android:theme"' to <activity> element at AndroidManifest.xml:66:9-70:47 to override.
Add the following to the manifest element in your AndroidManifest.xml file:
<manifest>
  ...
  xmlns:tools="http://schemas.android.com/tools"
  ...
</manifest>
And the following to the activity element:
<activity>
  ...
  tools:replace="android:theme"
  ...
</activity>