I’m looking at integrating support for tracking Facebook’s new mobile app ads.
I’ve read the tutorial here:
https://developers.facebook.com/docs/tutorials/mobile-app-ads/
It says:
Include the following code to be executed when your app opens for the first time by user
[FBSettings publishInstall:appId];
So the first question is – where do I put this so that it only invokes the call if the install was driven from Facebook? I don’t want FB to get credit for someone who found my app themselves on the app store.
Do I need to manually track whether or not I’ve called the publishInstall before for this specific user? (The preamble sentence implies this – but the SDK documentation for publishInstall implies otherwise).
And even more confusing is that the SDK FBSettings reference includes shouldAutoPublishInstall which defaults to YES. This would suggest that I don’t need to do anything other than have the SDK integrated. So why does the tutorial not mention this as an option?
I assume that the appId is the associated Facebook appId (as opposed to the App Store App ID). This is also not clear from the documentation.
I browsed the sources of facebook iOS SDK, and it seems that guide is wrong.
You are right, that
autoPublishInstallis set toYESby default, which means we don’t need to invoke[FBSettings publishInstall:appId];manually.AppIdis indeed the facebook app id.When you invoke
openActiveSessionWith....method, it initializesFBSessionwithinitWithAppID:permissions:defaultAudience:urlSchemeSuffix:tokenCacheStrategy:which contains in the end[FBSettings autoPublishInstall:self.appID];So technically it should report the install out of the box (if I’m not missing something). I’m going to play with it a little more today to see if it works as expected and update answer with results.