Requirements

  • DarkMatter version 4.2.x or greater.

Purpose

The old Ads system is being broken into two pieces. This will make managing other custom ad mediation services more seamless.

AdSystemAdapter

  • The generic Ad mediation system that will come with the DarkMatter library. Ad plugins and listeners will register with this service to get show ad requests and send delegate responses to listeners.

AdSystemPlugin

  • This will be any custom ad implementation that can be plugged into the adapter. The plugin will be responsible for managing either a mediation service and or the individual ad networks themselves.

AdSystemPluginMoPub

  • The old ad network services have been broken off into the AdSystemPluginMoPub. It will bridge between the unity c# and native iOS / Android systems.

IMPORTANT: The AdSystemAdapter by itself does not serve any ads. In order to receive ads a plugin will need to implement the IAdSystemPlugin interface and register as the active plugin with the AdSystemAdapter.

DarkMatter 4.1.x Update notes

  • The old Ads service which was effectively a MoPub wrapper has been renamed AdSystemPluginMoPub. The client should trigger ads through the general AdSystemAdapter and set itself as the listener.

  • The listener interface has been updated, use IAdSystemListener as the new Ads interface.

  • The new interface no longer includes separate callbacks for interstitials and reward video. You’ll need to check the placement id against the one your listening for to see if the callback relates to your placement

  • There is no longer custom callbacks for when an interstitial is skipped. These event will now come back through the onAdError with a reason of “AdSkipReasonImpressionsControl”

  • Some of the old static functionality of the DarkMatter.Ads service has been moved to the custom AdSystemPluginMoPub plugin. You’ll need to interface directly with the plugin if you still want to use this functionality. It’s recommended that you refactor out the use these functions as it will make switching between other AdSystemPlugins more labour intensive.

    • The following have been moved to AdSystemPluginMoPub and are not natively supported in the base AdSystemAdapter. See AdSystemPluginMoPub for more details.
      • static bool adReady;
      • static bool adShowing;
      • static bool rewardedVideoAdReady;
      • static void SetAdNetworkEnabled(string adNetworkName, bool enabled);
      • static void RemainingAttemptsForPlacement(string placement);

Manifest

  • Add a new “adsystemadapter” node to your manifest using the hope dashboard, for more details on what each node does see the Ads Manifest Keys documentation.
    "adsystemadapter": {
      "enabled": true,
      "analytics": true,
      "disabledPlacements": []
    }
    

Trigger Ad

  • Show interstitial
      AdSystemAdapter.showInterstitial("YOUR_PLACEMENT_ID");
    
  • Show rewarded video
      AdSystemAdapter.showRewardedVideo("YOUR_PLACEMENT_ID");
    
  • NOTE: Always set yourself as a listener before trying to show an ad as some errors may trigger the error response immediately.

IAdSystemPlugin

The IAdSystemPlugin interface passes the message to show an ad to the currently ad plugin

    void showInterstitial(string placement);
    void showRewardedVideo(string placement);

IAdSystemListener

The listener that the client should implement to get ad status events back from the AdSystemAdapter.

    void onAdLoading(string placement);
    void onAdReady(string placement);
    void onAdShown(string placement);
    void onAdDismissed(string placement);
    void onAdError(string placement, string errorReason);
    void onAdRewarded(string placement, string rewardLabel, int rewardAmount);