具有dfp中介网络的Facebook受众网络 [英] Facebook Audience Network with dfp mediation network

查看:120
本文介绍了具有dfp中介网络的Facebook受众网络的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

中所述,它已经使用dfp从admob获取广告. DFP Android指南.现在,我想通过dfp从Facebook受众网络中获取广告.我遵循了此处的指南,并添加了AudienceNetwork.jar进入我的应用.

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.

在我的订单项中,设置类型price priority并将sdk mediation广告与Facebook受众网络一起使用.

In my line item, I set type price priority and use sdk mediation ad with facebook audience network.

但是,当该应用运行时,我会看到以下消息,就像其他人报告了

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.

我认为该代码有效,并且dfp从Facebook受众网络中投放了广告.我对此非常确定,因为dfp和facebook控制台都显示广告请求信息.

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.

  1. 我是否正确设置了订单项?
  2. 我们如何解决广告尺寸不受支持的问题?


更新

  1. 该订单项设置没有问题.但是,如果您使用dfp进行调解,则需要在此处 a>
  2. 当前,最简单的解决方案是放弃智能横幅,改为使用横幅.这样一来,您就可以从Facebook受众网络中获取中介广告.
  3. 如果您使用proguard,请不要忘记添加-keep public class com.google.ads.mediation.** {*;}.否则,您将看到无法实例化Facebook适配器消息.
  1. Nothing wrong about the line item setting. But if you use dfp for mediation, you need to be aware of the priority here
  2. 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.
  3. 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.

推荐答案

我使用dfp sdk,因此,如果您使用其他sdk,则我不能保证它能正常工作.我的代码已经适用于admob和其他中介网络,因此我尝试添加Facebook受众网络.

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" /> 

请注意,我在这里使用 BANNER 而不是 SMART_BANNER ,某种程度上,dfp和facebook之间的横幅大小不兼容.我认为,这是sdk的问题.我希望Google以后可以解决此问题,但是我现在暂时放弃SMART_BANNER.正如我在更新中所述,如果您使用SMART_BANNER,您将得到此W/FacebookAdapter(18649): The input ad size is not supported at this moment.

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 -这是来自facebook ,您可以在其中找到AudienceNetwork.jar.

facebook android sdk - This one is from facebook, and you can find the AudienceNetwork.jar in it.

facebook适配器-来自

facebook adapter - This is from dfp mediation network, and you can find FacebookAdapter.jar.

在Android Studio中,您所需要做的就是将jars放入libs文件夹中,并确保build.gradle包含libs文件夹.

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')
...
}

以某种方式,当我构建apk时,即使我Synchronize 'build.gradle'也不编译库.因此,您可能要检查一下project.iml并确保在其中看到以下内容.

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

正如我在答复中所说,如果您使用Proguard,您一定不要忘记添加com.google.ads.mediation!否则,您将不断看到不能instantiate com.google.ads.mediation.facebookadapter class.

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 *; }

登录

这是您将看到是否所有配置均正确的消息.

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"}

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"}

如果您愿意放弃SMART BANNER,这是使用Audience Network的最简单方法.如果您必须使用SMART BANNER,建议您使用com.google.ads.mediation.customevent.CustomEventBanner来实现自定义事件横幅.在 Vpon的Google Admob中介中,它展示了自定义横幅广告的实现示例.我认为您将可以通过这种方式使用SMART_BANNER,这也意味着您必须自己转换广告尺寸.

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.

定位

实际上我不确定您是否可以使用Facebook受众网络进行定位,因为我在Facebook的官方文档中找不到任何有关定位的信息.

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.

您可以看到 dfp 自定义定位这样,我猜测,代码将类似于.addNetworkExtrasBundle(new com.google.ads.mediation.facebook.FacebookAdapter(), bundle).

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).

展示位置ID

如果您不熟悉如何使用从Facebook受众网络中获得的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:

  1. 创建订单
  2. 创建订单项
  3. 创建一个SDK mediation广告
  4. 选择下图所示的 Facebook Audience Network ,然后在其中放置您的展示位置ID.
  1. Create a line order
  2. Create a line item
  3. Create a SDK mediation creative
  4. 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.

您现在可以使用gradle安装受众网络库.

You can use gradle to install audience network library now.

compile 'com.facebook.android:audience-network-sdk:4.+'

有关更多信息,请参见在Android中使用原生广告API

More information at Using the Native Ad API in Android

如果您看到以下消息而未投放任何广告,则可能是因为您的设备或模拟器上未安装Facebook应用.

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.


2016年5月

Yoann Hercouet在LARGE_BANNER is also not available on Facebook的评论中指出.


May 2016

Yoann Hercouet points out in the comments that LARGE_BANNER is also not available on Facebook.

这篇关于具有dfp中介网络的Facebook受众网络的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆