如何用不支持的广告公司使用AdWhirl?[英] How to use AdWhirl with an unsupported ad company?

本文是小编为大家收集整理的关于如何用不支持的广告公司使用AdWhirl?的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

有人知道 AdWhirl 的工作原理吗?

我为 Greystripe 设置了自定义事件,如果 SDK 尚未初始化,我会在其中初始化 SDK,并刷新 BannerView,但我没有看到自定义事件被调用.所以我的主要问题是,AdWhirl 如何以及何时调用自定义事件?什么是口粮和翻滚?我没有用它们做过任何事情(主要是因为我不知道我为什么需要它们.AdWhirl 用它们做什么?)

此外,我如何控制 AdWhirl 何时刷新我的横幅?我想将刷新与按钮操作联系起来.

过去两天我一直在网上不停地搜索,并阅读了很多人们分享的教程和示例 Java 类,但没有一个奏效.看起来 AdWhirl 停滞不前了.我不清楚 AdWhirl 的工作原理:它在应用程序和您想在广告中使用的所有广告机会之间进行调解.这对我来说完全是一种太高级的理解,无法继续前进.:(

推荐答案

您是否阅读了 wiki 页面 描述了如何使用自定义事件?您基本上在后端 UI 中创建一个自定义事件,其行为类似于另一个广告网络,您可以配置它的流量.然后你可以实现你在后端命名的函数名称.唯一不直观的部分是您必须实现 AdWhirlInterface 来监听自定义事件,这意味着创建一个 adWhirlGeneric() 方法.虽然此方法可以为空,但我在创建自己的测试事件时没有看到它被调用.最后,确保设置 AdWhirlInterface.

因此假设您在后端创建了一个网络:

    Name: Test Network
    Function Name: testEvent

并为其提供流量(我建议在测试时为其提供 100% 的流量),那么您的代码将如下所示:

public class MyActivity extends Activity {
...
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    ...
  }
  ...

  public void testEvent() {
    // Place event code here.
    Log.d("Cust_Network", "Cust network got called!");
  }
}

例如,要控制刷新广告,请在点击按钮时调用 AdWhirlLayout 上的 rotateThreadedNow().这将使 AdWhirl 完成随机确定新广告网络的过程,并在这种情况下调用正确的适配器或自定义事件.如果你选择走这条路,你可能不想自动刷新,这种情况你应该在后端关闭自动刷新.

配给对象由配置数据中的数据填充.每个配给代表一个广告网络,并具有代表各个广告网络 ID、您在后端设置的权重百分比和回填优先级的键.回填优先级是如果原始请求未填充,AdWhirl 将请求的网络订单.这个经历回填优先级的过程称为翻转.在实现自己的自定义事件时,您需要了解一些关于翻转的知识.

提到的 wiki 页面有这些建议可以添加到您的自定义事件中:

    //  In your custom event code, you'll want to call some of the below methods.
    //
    //  On success:
    //  this.adWhirlLayout.adWhirlManager.resetRollover();
    //  this.adWhirlLayout.rotateThreadedDelayed();
    //
    //  On failure:
    //  this.adWhirlLayout.rolloverThreaded();

如果您的自定义事件正确获取广告,您将需要重置翻转顺序(以便下一个请求将具有正确的回填顺序),并调用rotateThreadedDelayed() 以便在一定时间内自动进行刷新您在后端指定.如果广告请求失败,您将需要调用 rolloverThreaded() 以便 AdWhirl 可以通过它的翻转过程来检查您其他配置的广告网络是否有广告.

其他推荐答案

如果您愿意,可以使用我开发的开源库,该库允许将 AdWhirl 与其他(不受支持的)广告网络(但也可以与官方的支持的).该库也是可扩展的,因此您可以向其中添加新网络并通过 AdWhirl 轻松管理.

该库是 AdMAL(广告中介抽象层),可根据 Apache 2.0 开源许可在 github.com 存储库中获得:https://github.com/marcosiino/AdMAL

使用 AdMAL,您可以轻松地在您的应用程序中为支持和不支持的网络实施 AdWhirl(集成比实施 AdWhirl SDK 更简单).实际上它只支持 iOS(它是用 Objective-C 开发的),但我计划在接下来的几个月内移植到 android.

我出于自己的目的启动了 AdMAL,然后几天前决定根据开源许可向公众发布它.希望这有帮助!我鼓励其他开发者改进库并实现新的网络支持,这样才能造福所有人.

本文地址:https://www.itbaoku.cn/post/102671.html

问题描述

Does anyone know how AdWhirl works?

I set up my custom event for Greystripe in which I initialize the SDK if it wasn't already initialized, and refresh the BannerView, but I don't see the custom event getting called. So my main question is, how and when does AdWhirl call the custom event? What are the rations and rollovers? I haven't done anything with them (mainly because I don't know why I need them. What does AdWhirl do with them?)

Also, how do I control when AdWhirl refreshes my banner? I'd like to tie the refresh with a button action.

I've been searching online nonstop for the past two days and read a lot of tutorials and example Java classes that people have shared, but none of them have worked. It just looks like AdWhirl is stagnate. It's so unclear to me how AdWhirl works beyond: it mediates between the app and all the ad opportunities you want to use in your ad. That's an entirely too high-level understanding for me to move forward. :(

推荐答案

Have you read the wiki page that describes how to use Custom Events? You basically create a custom event in the backend UI which behaves like another ad network, and you can configure it's traffic. Then you can implement the function name that you named in the backend. The only unintuitive part is that you have to implement AdWhirlInterface to listen for the custom event, which means creating an adWhirlGeneric() method. This method can be empty though, I am not seeing it called when creating my own test event. Finally, make sure to set the AdWhirlInterface.

So assuming on the backend you created a network with:

    Name: Test Network
    Function Name: testEvent

and gave it traffic (I recommend giving it 100% traffic when testing), then your code would look something like this:

public class MyActivity extends Activity {
...
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    ...
  }
  ...

  public void testEvent() {
    // Place event code here.
    Log.d("Cust_Network", "Cust network got called!");
  }
}

To control refreshing your ad, call rotateThreadedNow() on the AdWhirlLayout when a button is clicked, for example. This will take AdWhirl through the process of randomly determining a new ad network, and calling the correct adapter, or custom event in this case. If you choose to go this route, you may not want automatic refreshing, in which case you should disable automatic refreshing on the back end.

The ration object is populated with data from the configuration data. Each ration represents an ad network, and has keys which represent the individual ad network ids, weight percentages that you set in the backend, and backfill priority. Backfill priority is the network order that AdWhirl will request from if the original request did not fill. This process of going through backfill priority is called rollover. You will need to know a little bit about rollover when implementing your own custom event.

The wiki page mentioned has these recommendations to add to your custom event:

    //  In your custom event code, you'll want to call some of the below methods.
    //
    //  On success:
    //  this.adWhirlLayout.adWhirlManager.resetRollover();
    //  this.adWhirlLayout.rotateThreadedDelayed();
    //
    //  On failure:
    //  this.adWhirlLayout.rolloverThreaded();

If your custom event properly fetches an ad, you will want to reset the rollover order (so the next request will have the correct backfill order), and call rotateThreadedDelayed() so that a refresh will happen automatically in the amount of time you specified on the back end. If the ad request failed, you will want to call rolloverThreaded() so that AdWhirl can go through it's rollover process to check your other configured ad networks for ads.

其他推荐答案

if you want you can use an open source library i've developed that allows to use AdWhirl with other (unsupported) ad networks (but also with the officially supported ones). This library is also extensible, so you can add a new network to it and manage easily through AdWhirl.

The library is AdMAL (Ad Mediation Abstraction Layer) and is available on a github.com repository under the Apache 2.0 open source license: https://github.com/marcosiino/AdMAL

Using AdMAL you can easily implement AdWhirl in your applications for both supported and unsupported network (the integration is easiest than implementing AdWhirl SDK). Actually it only supports iOS (it's developed in Objective-C), but i plan to port to android in the next months.

I started AdMAL for my own purposes, then decided to release it to the public under an open source license some days ago. Hope this help! I encourage other developers to improve the library and implement new networks support, so that this can benefit to everyone.