Facebook Audience Network with dfp mediation network - google-dfp

App
It already uses dfp to get ads from admob as described in DFP Android Guides. Now I want to get ads from facebook audience network through dfp. I follow the guide here and add FacebookAdapter.jar and AudienceNetwork.jar into my app.
DFP
In my line item, I set type price priority and use sdk mediation ad with facebook audience network.
Condition
However, when the app runs, I see the following message just like someone else reported here.
W/FacebookAdapter(18649): The input ad size is not supported at this moment.
I think the code works, and dfp delivers the ads from facebook audience network. I am pretty sure about this because both dfp and facebook console show the ad request information.
Questions
Do I setup the line item correctly?
How could we fix the issue of unsupported ad size?
Update
Nothing wrong about the line item setting. But if you use dfp for mediation, you need to be aware of the priority here
Currently, the simplest solution is to give up smart banner and use banner instead. This would allow you to get mediation ad from facebook audience network.
Don't forget to add -keep public class com.google.ads.mediation.** {*;} if you use proguard. Otherwise, you will see couldn't instantiate facebook adapter message.

I use dfp sdk so if you use other sdk, I cannot guarantee it works. My code already works for admob and other mediation network, and I try to add facebook audience network.
layout.xml
<com.google.android.gms.ads.doubleclick.PublisherAdView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="#+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="#string/ad_unit_id"
android:visibility="gone" />
Note that I use BANNER instead of SMART_BANNER here, somehow, the banner size is incompatible between dfp and facebook. In my opinion, this is an issue of sdk. I hope google would fix this later, but I just give up SMART_BANNER for now. As I mentioned in the update, if you use SMART_BANNER, you will get this W/FacebookAdapter(18649): The input ad size is not supported at this moment.
jar
facebook android sdk - This one is from facebook, and you can find the AudienceNetwork.jar in it.
facebook adapter - This is from dfp mediation network, and you can find FacebookAdapter.jar.
In Android Studio, all you need to do is put jars in your libs folder and make sure your build.gradle includes the libs folder.
build.gradle
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
...
}
Somehow, when I build the apk, the libraries are not compiled even when I Synchronize 'build.gradle'. Hence, you might want to check your project.iml and make sure you see the following in it.
project.iml
...
<orderEntry type="library" exported="" name="AudienceNetwork" level="project" />
<orderEntry type="library" exported="" name="FacebookAdapter" level="project" />
Proguard
As I said in the reply, you must not forget to add com.google.ads.mediation if you use Proguard! Otherwise, you will keep seeing cannot instantiate com.google.ads.mediation.facebookadapter class.
-keep public class com.google.ads.mediation.** { public *; }
Log
This is the message you will see if everything is configured properly.
02-18 16:24:25.315 8081-8307/com.xxxxxxx I/Ads﹕ Trying mediation network: 1.0568273599589929E19
02-18 16:24:25.320 8081-8081/com.xxxxxxx I/Ads﹕ Instantiating mediation adapter: com.google.ads.mediation.facebook.FacebookAdapter
02-18 16:24:25.335 8081-8081/com.xxxxxxx W/Ads﹕ Server parameters: {"gwhirl_share_location":"1","pubid":"xxxxxxxxxxxxx_xxxxxxxxxxxxx"}
This is the simplest way to use Audience Network if you are willing to give up SMART BANNER. If you must use SMART BANNER, I suggest you to implement custom event banner using com.google.ads.mediation.customevent.CustomEventBanner yourself. In Vpon's Google Admob Mediation, it shows an example of implementation of custom evener banner. I think you will be able to use SMART_BANNER in this way, and it also means that you have to convert the ad size yourself.
Update
Targeting
I am actually not sure about if you can do targeting with facebook audience network or not because I cannot find anything about targeting in facebook's official document.
You can see dfp Custom targeting for this, and I guess the code would be something like .addNetworkExtrasBundle(new com.google.ads.mediation.facebook.FacebookAdapter(), bundle).
Placement id
In case you're not familiar with how to use placement_id you get from facebook audience network, you have to do the following things:
Create a line order
Create a line item
Create a SDK mediation creative
Select Facebook Audience Network like the image below and put your placement id there.
This is the very simple version of how you do it, and you should know that the setting of line item will have effects on ads. If you settings are not correct, for example, the item's type priority is too low or frequency capping is too long, you might not see the ads.
Feb 2016
You can use gradle to install audience network library now.
compile 'com.facebook.android:audience-network-sdk:4.+'
More information at Using the Native Ad API in Android
If you see the following messages without delivering any ad, that is probably because you don't have facebook app installed on your device or emulator.
E/ActivityThread: Failed to find provider info for com.facebook.katana.provider.AttributionIdProvider
W/FacebookAdapter: No fill. We are not able to serve ads to this person. Please refer to https://developers.facebook.com/docs/audience-network/faq#a12. If you are integrating Audience Network for the first time, you can use test ads https://developers.facebook.com/docs/audience-network/testing.
May 2016
Yoann Hercouet points out in the comments that LARGE_BANNER is also not available on Facebook.

there is a adsize matching issue inside the FacebookAdapter:
https://groups.google.com/forum/#!category-topic/google-admob-ads-sdk/android/MWoBWBR0FQM

Related

Failure to Launch Apps Due to Package Name Inconsistency

When I used huawei AppLinking Service, the app package name is queried to locate the app details page. However, the app package name varies depending on the channel. For example, for a Huawei channel, the package name ends with .huawei, which is different from that in a Google channel.Does this mean it's impossible for an App Linking link to be opened in all local app stores due to package name inconsistency?
Does this mean it's impossible for an App Linking link to be opened in
all local app stores due to package name inconsistency?
The answer is no because there is a solution to this problem.
Perform the following to resolve the issue:
We know that App Linking can redirect users to a custom website if the app has not been installed, so you can use Android intents to create custom links, in which you can configure the package name and fallback URL to be opened. The basic syntax is as follows:
intent:
HOST/URI-path // Optional host
#Intent;
package=[string];
action=[string];
category=[string];
component=[string];
scheme=[string];
S.browser_fallback_url=[encoded_full_url]
end;
Taking advantage of the preceding functions, you can:
Create a link of App Linking and use the setOpenType(CustomUrl) method to set the open type to redirect users to a custom website for the Android platform. The involved APIs are as follows:
.setAndroidLinkInfo(new AppLinking.AndroidLinkInfo.Builder()
.setAndroidDeepLink(Android_LINK)
.setOpenType(CustomUrl)
.setFallbackUrl(BACK_LINK)
.build())
Use an Android intent to configure the preceding custom website. Here, I use Taobao as an example:
"intent://details?id=com.taobao.taobao#Intent;scheme=appmarket;package=com.huawei.appmarket;S.browser_fallback_url=https://play.google.com/store/apps/details?id=com.taobao.taobao;end"
The process is as follows:
1.Use the appmarket scheme to start the app whose package name is com.huawei.appmarket, that is, to open HUAWEI AppGallery.
2.Pass the package name com.taobao.taobao to HUAWEI AppGallery. Then, HUAWEI AppGallery will start this package.
3.If com.huawei.appmarket is not found, set S.browser_fallback_url to a fallback URL.
4.The fallback URL is a Google Play link. Simply set id in this URL to the name of the package to be opened. In this example, the ID is com.taobao.taobao.
Ensure that an App Linking project of the Android platform has been completed. For details, visit:
https://forums.developer.huawei.com/forumPortal/en/topic/0204442462434640048?fid=0101188387844930001
Open the original App Linking project and add the following information in bold:
String BACK_LINK = "intent://details?id=com.taobao.taobao#Intent;" +
"scheme=appmarket;package=com.huawei.appmarket;" +
"S.browser_fallback_url=https://play.google.com/store/apps/details?" +
"id=com.taobao.taobao;end";
AppLinking.Builder builder = new AppLinking.Builder()
.setUriPrefix(DOMAIN_URI_PREFIX)
.setDeepLink(Uri.parse(DEEP_LINK))
.setAndroidLinkInfo(new AppLinking.AndroidLinkInfo.Builder()
.setAndroidDeepLink(Android_DEEP_LINK)
.setOpenType(CustomUrl)
.setFallbackUrl(BACK_LINK)
.build());
Test:
Install the demo on a device, create a link of App Linking, and add it to the note.
Uninstall the app to simulate the scenario where the app is not installed.
For a Huawei phone, tap Open/Download. On AppGallery that is displayed, open the Taobao details page. The following figure shows the Taobao details page in HUAWEI Browser.
For a non-Huawei phone, tap Open/Download. On Google Play that is displayed, open the Taobao details page. The following figure shows the Taobao details page in Google Chrome.
The problem is now resolved. If you encounter a similar problem, simply follow my example step by step and change the package name to resolve the issue.
For more details, please go to:
https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-applinking-introduction?ha_source=hms1

getKeywordStats() not working (Facebook API Java SDK )

I'm using the official Facebook API Java SDK to retrieve stats for each of the interests used in the targeting of a specific ad (as described in https://developers.facebook.com/docs/marketing-api/reference/ad-keyword-stats). When trying the call in Graph Explorer it works perfectly but I get an empty response in Java. I have already used the SDK to get insights for campaigns, ad sets and ads so the general setup is working. This is the code I have for now:
APINodeList<AdKeywordStats> stats = new Ad(adId, CONTEXT).getKeywordStats()
.requestAllFields().execute();
System.out.println(stats);
EDIT:
After some digging I think I found the cause of the problem, hopefully this PR should fix it: https://github.com/facebook/facebook-java-ads-sdk/pull/149

Is there a Google DFP api to check whether an ad units is active or not?

Is there a Google DFP api to check whether an ad unit is active or not ?
Any suggestions are appreciated! Thanks
The google publisher console can help check for active ad units, https://support.google.com/dfp_sb/answer/2462712?hl=en.
It depends on what you mean by "whether an ad unit is active or not". In general it's best to be as descriptive as posible in questions and to include what you've already tried, it saves time in the answers. I'll do my best.
If you're trying to debug whether it was properly loaded on the site, then I'd suggest you debug using the DoubleClick Publisher Console, which you can activate by adding ?googfc to the end of the URL. In there you can check which ad units are called and their status, and you can also follow the execution on the History tab inside the console.
You could also use the Google Publisher Toolbar chrome extension, which has some more information on the ad being rendered, the line item, etc.
Moreover, you could set up an event listener and render information to the developer console.
googletag.pubads().addEventListener('slotRenderEnded', function(event) {
console.info(event);
}
});
This code should be included inside the googlgoogletag.cmd.push(function() {}) and below the slot definitions (e.g.: the method defineSlot()).
However, if you want to do is programatically check if an ad unit is active prior to calling it or defining it, then I think you should rephrase the question to be a bit more specific.

Windows Phone 8 facebook login (Beta)

I've been going through the instructions here trying to implement the FB login via the FB Beta application: http://facebooksdk.net/docs/phone/sso/
I had it working for a while, however ever since the last Beta update, something started failing.
Whenever i get a callback to MapUri from the FB application, i don't get the proper Uri being passed in. The following code always fails (the uri contains mundane URIs of pages within the application, not what i expected).
AppAuthenticationHelper.IsFacebookLoginResponse(uri)
I might have changes something on the web-configuration of the application, or on the WP8, however going over the settings, nothing seems to be working.
I checked the usual suspects (AppIds, ProductIds etc...) and it seems to be running properly, so that changing one of those IDs throws the error like i expect it to, however when i have setup everything properly, i get the facebook application to open my application, however the UriMapperBase when it get's called never has the proper Uri in it.
Here is the configuration for the WMAppManifest for the extension:
<Extensions>
<Protocol Name="msft-54045783c54e4c3a9f2b470c5b7ba353" NavUriFragment="encodedLaunchUri=%s" TaskID="_default" />
</Extensions>
Any ideas?
P.S. I am testing this on real devices with the latest FB Beta application.
UPDATE: Seems to only affect Samsung phones, no issues with HTC, haven't tried other ones.

Facebook Follow Button plugin doesn't allow periods in profile

Trying to set up a follow button with Facebook's plugin here:
https://developers.facebook.com/docs/reference/plugins/follow/
I've found that any profile url I enter that contains periods (for example, http://www.facebook.com/John.Smith) will return an error.
From the error console I receive
Failed to load resource: The requested URL was not found on this server.
This happens with the HTML5, iframe and URL versions of the plugin. Just out of curiosity I tried encoding the period with %2E, and I also tried using the numeric profile ID, but neither worked.
Is there any other trick I can try to make this work?
I don't think it's a problem with the social plugin. please enter the profile https://www.facebook.com/michael.kamleitner for testing purposes - everything's fine here.
If I open the profile url of John Smith I'm getting an error ("Page not found") - so imho the profile is restricted/not public at all. If it's privacy restricted, you can't use it for the follow-plugin. If you have access to John Smith's account, please double check his follower-settings: https://www.facebook.com/settings?tab=followers