Ads Wrapper

Ads Wrapper

Ads Wrapper is a wrapper for advertising services. It allows you to use one interface for different services and show ads from different sources. We use this extension all the time in our projects. It simplifies development for different platforms and allows you to create advertising mediation.

Supported services:

Github: https://github.com/potatojam/defold-ads-wrapper

19 Likes

This is amazing! Thank you for sharing! :heart:

5 Likes

Indeed, this is really great! I’ve been thinking of something like this for a while. Thank you!

3 Likes

Is there any method like “is_ads_loaded”?

There is no direct function.
You can manually save the value when using the ad function. Example:

local is_rewarded_loaded = false
ads_wrapper.load_rewarded(function(response)
    if response.result == events.SUCCESS then
          is_rewarded_loaded = true
    end
end)

Or you can find it out for a specific network:

local admob_network = require("ads_wrapper.ads_networks.admob")
admob_network.is_rewarded_loaded()
admob_network.is_interstitial_loaded()
admob_network.is_banner_loaded()

I have not come across a situation where they were needed. I can add such functions for the network pointed to by the mediator, if you need them specifically in ads_wrapper.

3 Likes

Thanks for your work @sergeysinyavsky, would you be kind to please include Appodeal in your extension?

Haven’t worked with Appodeal yet. Maybe I’ll take a look in my free time.
You can add the service you need yourself. You need to implement these functions:

5 Likes

Thanks for the explanation!

These methods are needed, for example

  1. when the game prompts the player to continue playing the level for virtual currency (1) or viewing ADS (2),
  2. or offers to collect a free daily gift (1) or X2 daily gift when viewing ads (2)
    and etc

It’ll be great if you add these methods, or I can add them myself and make pull request :wink:

3 Likes

New version 0.6.2 released.

Some bugs have been fixed.
When loading, the pointer moved to the next network. For now, he remains on the network for which he loaded.

Now you can find out if the ad was loaded. Also you can get used networks.
Functions:

ads_wrapper.is_interstitial_loaded(check_current)
ads_wrapper.is_rewarded_loaded(check_current)
ads_wrapper.is_banner_loaded(check_current)
ads_wrapper.get_current_network(check_banner)
ads_wrapper.get_next_network(check_banner)

If you are using only one network, then the check_current parameter is not needed.

More info about functions:

If you want to add something, feel free to make a pull request. I will be glad!

6 Likes

Awesome!!! Thank you!!!

1 Like

New version 1.0.0 released.

Added Applovin Max network.
It use next extension: https://github.com/alexeyfeskov/defold-maxsdk

Fixed M.show_banner(callback) and M.hide_banner(callback) functions for networks.
Now they should call a function, not return a value.
:warning: These functions need to be fixed if you use your own networks.

6 Likes