How do I implement Facebook Mobile Install Ad tracking in Phonegap/Cordova project?

后端 未结 3 915
梦谈多话
梦谈多话 2021-01-12 17:13

Ok, so I\'ve got a \"completed\" iOS phonegap/cordova project, using version 3.4 in xcode 5. I know I need to integrate the facebook sdk in order to track the installs for m

相关标签:
3条回答
  • 2021-01-12 17:24

    I don't have a full answer, but I'm in a similar position. My understanding is yes you need to install the Facebook SDK, and yes you'll need to add the ObjectiveC config stuff to UIApplicationDelegate. However I believe you do not need the phonegap-facebook-plugin and I would suggest you stay clear of it, at least while it has 216 open issues and lags the iOS Facebook SDK by several versions. Of course, your mileage may vary, but I'm fairly certain it is not required for Mobile Ads tracking.

    0 讨论(0)
  • 2021-01-12 17:33

    It's done automatically by the javascript sdk:

    https://developers.facebook.com/docs/reference/javascript/FB.AppEvents.LogEvent#examples

    0 讨论(0)
  • 2021-01-12 17:48

    Having looked at this issue again, the answer is pretty simple.

    Follow the instructions for creating an app and installing the SDK:

    It tells you exactly how to do this for iOS here https://developers.facebook.com/docs/ios/getting-started/

    Make sure to follow the instructions to the letter and that you add the relevant rows/values to your project's .plist file.

    The final piece of information you'll need is understanding the import of the Facebook SDK header file into the AppDelegate.m file in your Xcode project and the applicationDidBecomeActive selector.

    In your project's ApplicationDelegate.m file copy #import <FacebookSDK/FacebookSDK.h> directly below your other import statements. Hint: they look similar and are near the top.

    Now copy the following into your AppDelegate.m replacing the dummy app id @"123456789" with your facebook app id. Place this code directly above @end in your AppDelegate.m file.

    -(void)applicationDidBecomeActive:(UIApplication *)application
    {
    
        [FBSettings setDefaultAppID: @"123456789"];
        [FBAppEvents activateApp];
    
    }
    

    That's it. Now you can try an install of your app onto your development device and check it's reporting correctly by visiting your app dashboard on Facebook, scrolling down to the bottom, or finding the section about latest installs.

    0 讨论(0)
提交回复
热议问题