How to implement ad tracking for Facebook mobile devices in the Phonegap / Cordova project?

So, I have a “completed” iOS phonegap / cordova project using version 3.4 in xcode 5. I know that I need to integrate sdk into facebook in order to track the settings for mobile ads.

It will just integrate sdk according to Facebook instructions here https://developers.facebook.com/docs/ios/getting-started/ to do this work or I need to use the whole plugin to connect facebook as described here https://github.com / phonegap / phonegap-facebook-plugin , what do I need to track installations?

Also, when this takes care, I need to add the following to the UIApplicationDelegate applicationDidBecomeActive application selector

[FBSettings setDefaultAppID:YOUR_APP_ID]; [FBAppEvents activateApp]; 

However, I cannot find a clear answer to exactly where I need to place this (I know little about obj-c), where and in which file in my xcode project do I need to place this? I found this from the transcript of an open session by a telephone stammer, it didn’t help me, but there might be something for you to say:

Sometimes some SDKs or others ask us to add a few lines to objective-C, for example Facebook for “Announcement on installing a mobile application”, they ask to add “[FBSettings publishInstall: YOUR_APP_ID]” to the UIApplicationDelegate applicationDidBecomeActive selector - but with the project’s telephone connection, we don’t have this method, so is there an equivalent in the code generated by the telephone? A: If you are developing locally using Xcode, you can access this method in the application delegation class. This is not available inside the PhoneGap Build service.

Thank you for your help.

+6
source share
3 answers

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

Follow the instructions to create the application and install the SDK:

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

Be sure to follow the instructions for the letter and add the appropriate lines / values ​​to the .plist project file.

The final piece of information you will need is an understanding of importing the header file of the SDK file into the AppDelegate.m file in the Xcode project and the applicationDidBecomeActive selector.

In your ApplicationDelegate.m project, copy the #import <FacebookSDK/FacebookSDK.h> file directly below your other import operations. Hint: they look the same and are closer to the top.

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

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

What is it. Now you can try to install the application on your development device and check the accuracy of its reporting by visiting the application toolbar on Facebook, scrolling down or find the section on the latest installations.

+3
source

I do not have the full answer, but I am in a similar position. I understand that you need to install the SDK for Facebook, and yes, you will need to add ObjectiveC configuration material to UIApplicationDelegate. However, I believe that you do not need the phonegap-facebook plugin, and I suggest that you stay away from it, at least as long as it has 216 open problems and lags behind the iOS Facebook SDK by several versions. Of course, your mileage may vary, but I'm sure it is not required to track mobile ads.

0
source

Source: https://habr.com/ru/post/959098/


All Articles