Recently, I need to integrate The Facebook advertising SDK for an overseas APP. I thought it would be so simple to integrate the SDK, but since Facebook is such a big company, it should be more simple with examples and documents. Unexpectedly, the integration process or stepped on a lot of pits, and online mentioned effective solutions are very few, so here the author will be integrated encountered pits and solutions to share out.
I. Introduction to integration of Facebook Audience Network SDK
The development document of Facebook Audience Network SDK is very detailed. The whole integration process and the introduction of various types of advertisements are quite comprehensive, and corresponding Demo is provided, which is very friendly for developers to integrate SDK into APP. However, there are a few things to be aware of during integration, mainly during the debug AD display phase. Specific AD integration reference documents and demos can generally be integrated without further ado here. Let me share a few potholes that block integration progress. The following content is for Android devices, but also for iOS integration.
Ii. Integrated With Facebook Audience Network SDK, trekking journey
1. The test AD display requires the Installation of the Facebook APP and Google Play store
Facebook ads need to be displayed on phones that have apps from the Facebook and Google Play stores installed and have a Facebook account in order to display Facebook ads on apps that integrate with the AD SDK. So if you can’t display Facebook ads, check to see if you have the Facebook APP installed on your phone.
2. Use an active Facebook account when testing ads
If you sign into a new Account on Facebook’s APP when testing ads, it’s highly unlikely that the ads will show up. That’s because Facebook doesn’t know the AD interests of new users, so it doesn’t serve ads to users who aren’t active.
There are several ways to test the AD display, each of which has different characteristics. The author made a summary, in the following classified as a big point to write.
Three, test several ways of advertising display
1. How the client inserts the test code
This method requires that you have already applied for the advertisement version on Facebook Audience Network and get the Placement Id. In this way, you need to modify the client code according to the changes, so it is not very convenient, but fast. Importantly, this way you can only see Facebook’s test ads.
a. AdSettings.addTestDevice(String deviceIdHash)
Add the adSettings. addTestDevice(String deviceIdHash) code before the AD display, and the AD SDK will return the test AD with the AD type set by the Placement Id. So where does this deviceIdHash come from? Display the AD before adding this code and it will show up in the log
When testing your app with Facebook's ad units you must specify the device hashed ID to ensure the delivery of test ads, add the following code before loading an ad: AdSettings.addTestDevice("caa50f99-1852-4e4d-a730-160ea59e4d1b");
Copy the code
Just copy and paste the code adsettings.addTestDevice (” CAa50f99-1852-4e4D-a730-160ea59e4d1b “) from the log.
b. TEST_AD_TYPE
Add the test AD type in front of your Placement Id in the format TEST_AD_TYPE#YOUR_PLACEMENT_ID. Facebook offers 11 types of test ads, which can be found in the official documentation. This approach also returns only test ads.
The above mentioned method can only show the test ads, but if you want to get real ads for testing, you need to use the following two methods.
A. Add test device AAID
AAID, or Google Advertising ID, is an AD ID that Google uses to identify users. In this way, real advertising data can be obtained. However, when debugging, it will be found that the displayed ads are not restricted by the Settings in the advertising console, for example, the console is set to display only native video ads, and the actual return of the AD content will also include rotation ads and graphic ads. Therefore, this method is not limited by the Settings of the console, if you want to obtain certain conditions of the AD, the following method is also required.
B. Add the Facebook account as the test account
If you add your Facebook account as a test account in the background and log in to your mobile phone’s Facebook APP, you can get the desired AD content according to the console Settings. However, this approach has a hidden pit on Android devices. After one operation, you will find that the status code 1001 will be returned when you get the advertisement on the APP. The status information of No Fill means that the advertisement space is not filled in. After checking the account from beginning to end, we found that the account is active and the various configurations are ok, except that no ads can be displayed. In this case, you need to log out of your Facebook account, go to reset AAID, and then log in to Facebook. Through this step, the AD can be received upon re-request. If one operation is not feasible, repeat it several times.
Third, summary
The above are the problems encountered by the author in the integration of Facebook advertising SDK, mainly focusing on the debugging of advertising display in this aspect, may be more helpful to the partners who have just integrated Facebook advertising SDK.