SDK Integration

Overview

Consoliads SDK is a Unity SDK integrated with the most number of ad networks which eliminates the requirement to integrate different Ad Network SDKs into your application, simultaneously, to maximize revenue. Just integrate Consoliads SDK and simply configure it in your unity project to show Ads of different Ad Networks.

Next you can configure your application online and manage Ads in the Admin Panel Dashboard of ConsoliAds
You can always optimize your ads to increase revenue depending on the stats visible in your admin panel. It enables you to change, manage and disable ads for effective intelligence. Make changes, and get to know which combination of ads gives you the best revenue.

ConsoliAds SDK has a simple inspector view in unity. It enables you to just fill up the information that is required and make it work without any complications.

To add ConsoliAds SDK to your games promptly, you just need to take care of a few constituents:

  • A ConsoliAds Account
  • Latest ConsoliAds SDK
  • Unity Installed

Setting up SDK

Download SDK

Download the latest ConsoliAds SDK from your admin panel in help

Save it in your computer

Import SDK

  • Open your Unity Project
  • Open ConsoliAds SDK You Downloaded
  • A Dialog box will appear
  • Click Import button to import ConsoliAds SDK into your project

Add prefab to your scene

Now in your project explorer Go to “Assests\ConsoliAds\Prefabs” or search for “ConsoliAds.prefab”; drag and drop it into your scene

Fill up Information

  • In the hierarchy tab select the ConsoliAds game object
  • Next in the Unity Inspector view of ConsoliAds game object
  • You need to fill up the required information
  • First you need to enter your user signature (for your verification).
    You can get this by:
    • Signing in to your ConsoliAds account
    • Then going into your Personal Info by clicking on your name in the right corner of the top bar and there you will have an interface containing your personal user signature
    • Put that user signature in the ConsoliAds Inspector view in unity
  • After you have followed the previous steps successfully, enter your Application Name in the Product Name option
  • Select your Application Platform (Google, Apple, Windows)
  • Next you need to Enter your application's unique Package name in the Bundle Identifier field
  • (Optional) You can enter your application's version in the Bundle Version option

Creating Scene List

  • In Your ConsoliAds Inspector
  • You will see an expandable option for Scene List
  • Click on that and you will see a field "Size"
  • In the "Size" field enter the number of scenes (places to show ads) you want in your application and press Enter
  • According to your given size, expandable scene elements will be created in which you will further need to specify the certain ad networks you want to show in each scene element

Specifying Scene Details

  • After Creating Scene List you will need to specify ad networks to show in those scenes
  • Click on a Scene Element you previously created. For example Element 0
  • You will see 4 options
    • Scene Type
    • Ad Network List
    • Fail Over
    • Skip First
  • Scene Type is the specific application scene in which you want your ads to appear
  • Ad Network List is the list of Ads from those Ad Networks to show in this Scene Element
  • Fail over is the ad to show if any of the sequence ads failed to show
  • Skip first is a check to skip ad in a first game play

Specifying Ad Network List

  • Click on the Ad Network List option
  • You will see a size option
  • in this size option give the number of ad Networks you want to show in this Scene and press Enter
  • For example 3 is given in the following image
  • After pressing Enter, Ad Network List will form depending upon the given size
  • Each element of the list is a drop down
  • Just select the name of an ad Network

Add/Remove Ad Networks

  • If you see this error on Configure Server refer to the documentation on how to Add/Remove ad networks from Consoliads plugin

Pre-Loaded Assets Settings

  • Make sure that in Pre-loaded assets -> stripping level should be selected as Disabled

Configuring Server

  • Next at the bottom of the inspector there is a button to configure server
  • Click on the button and your Application will be configured with the online server
  • If your application does not exist on server, it will be created with the details you’ve provided
  • The Scene list you have specified with ad list and other parameters will be added or overwritten on server
  • If your scene list size and names are same, nothing will be overwritten and scene settings from server will be overwritten in unity
  • Ad Ids will be fetched from server, if not present on server then the ones you added in unity inspector will be used

Showing Ads

  • In Your application where you want to show a Scene
  • you will need to write code given below:
  •                             ConsoliAds.Instance.ShowAd (0);
                                
  • In the above Code ShowAd method has a parameter 0 i.e. the Scene Element Number
  • Similarly, you will use this method to show other Scenes
  •                             ConsoliAds.Instance.ShowAd (1);
                                
  • and the Ad Network List in that Scene will be shown one after another

Hiding Ads

  • If you want to hide all ads
  • you will need to write the following code
  •                             ConsoliAds.Instance.hideAllAds();
                                
  • You only need to call this function once in your script and whenever user starts your application ads will not show

Using Admob Banner

  • From ConsoliAds Unity Inspector you need to do the following steps:
  • Enable/Disable Admob Banner
  • Select Admob Banner Size
  • Select Admob Banner Position



  • To show Admob Banner you need to use the following code in your desired script:
  •                             ConsoliAds.Instance.showAdmobBanner();
                                


  • To hide Admob Banner you can use this code:
  •                             ConsoliAds.Instance.hideAdmobBanner();
                                

Using Analytics (Google, Flurry)

  • ConsoliAds implements Google and Flurry Analytics
  • From ConsoliAds Unity Inspector, select the Analytics type needed to use
  • Provide Google Analytics Tracking Code and Flurry App Key in the inspector as seen in the below image
  • These Codes and Keys can be added in web portal and will be available in unity inspector upon Configuring Server



  • After that your selected Analytics type will be initialized once the ConsoliAds game object is initialized
  • Following methods for the selected Analytics is implemented in ConsoliAds

  •                             ConsoliAds.Instance.LogEvent(string category, string label, string action, long value);
    ConsoliAds.Instance.LogScreen(string title);


    ConsoliAds.Instance.googleAnalytics.LogTransaction(string transID, 
    string affiliation,
    double revenue,
    double tax,
    double shipping,
    string currencyCode);

    Flurry.Instance.LogEvent(string title);

Using Firebase Analytics

iOS

For iOS you just need to place the GoogleService-Info.plist file at the root of your xcode project.

Android

To use firebase for android you must follow the below steps

  • make sure you have strings.xml file present in Plugins\Android\res\values directory
  • get your google-services.json file from the firebase console
  • Next you need to copy some keys from this file to the strings.xml file
  • The google-services.json file has the following basic structure:
                            {
                            "project_info": {...},
                            "client": [...],
                            }
  • The project_info object contains general information about your project, while each member of the client array contains information about the clients (Android apps) that you have added to the project.
  • only use the client object that matches your package name (for the current build type) based.
  • Every value in the XML file is present in the google-services.json file at the locations below. google_app_id:
    {YOUR_CLIENT}/client_info/mobilesdk_app_id
    gcm_defaultSenderId:
    project_info/project_number
    default_web_client_id:
    {YOUR_CLIENT}/oauth_client/client_id (client_type == 3)
    ga_trackingId:
    {YOUR_CLIENT}/services/analytics-service/analytics_property/tracking_id
    firebase_database_url:
    project_info/firebase_url
    google_api_key:
    {YOUR_CLIENT}/api_key/current_key
    google_crash_reporting_api_key:
    {YOUR_CLIENT}/api_key/current_key
Now, firebase will be initialized from strings.xml

Log Events

To log Events use the below code
                    ConsoliAds.Instance.firebase.LogEvent("EventName", "Action", "SceneType");
                    ConsoliAds.Instance.firebase.LogSelectContent("itemID", "contentType");
                        
All available methods
                    ConsoliAds.Instance.firebase.LogEvent(string eventName, string action, string sceneType);
                    ConsoliAds.Instance.firebase.LogSelectContent(string itemID, string contentType);
                    ConsoliAds.Instance.firebase.LogJoinGroup(string groupID);
                    ConsoliAds.Instance.firebase.LogLevelUp(string character, long level);
                    ConsoliAds.Instance.firebase.LogPostScore(long score);
                    ConsoliAds.Instance.firebase.LogPostScore(long score, long level);
                    ConsoliAds.Instance.firebase.LogPostScore(long score, long level, string character);
                    ConsoliAds.Instance.firebase.LogSpendVirtualCurrency(string itemName, string virtualCurrencyName, long value);
                    ConsoliAds.Instance.firebase.LogTutorialBegin();
                    ConsoliAds.Instance.firebase.LogTutorialComplete();
                    ConsoliAds.Instance.firebase.LogUnlockAchievement(string achievementID);
                        

Using Interstitial And Video

  • From ConsoliAds Unity Inspector you need to do the following steps:
  • Skip First (enable/disable).
  • Enter the size of network list.
  • Select the network provider on each list.
  • Select the fail over ad network.



  • To show interstitial you need to use the following code in your desired script:
  •                             ConsoliAds.Instance.ShowInterstitial(0);  
                                


Using Rewarded Video

  • From ConsoliAds Unity Inspector you need to do the following steps:
  • Skip First (enable/disable).
  • Enter the size of network list.
  • Select the network provider on each list.
  • Select the fail over ad network.



  • To show Rewarded video you need to use the following code in your desired script:
  •                             ConsoliAds.Instance.ShowRewardedVideo(sceneID); 
                                


Using Admob Banner

  • From ConsoliAds Unity Inspector you need to do the following steps:
  • Enable/Disable Admob Banner
  • Select Admob Banner Size
  • Select Admob Banner Position



  • To show Admob Banner you need to use the following code in your desired script:
  •                             ConsoliAds.Instance.showAdmobBanner();
                                


  • To hide Admob Banner you can use this code:
  •                             ConsoliAds.Instance.hideAdmobBanner();
                                

Using Admob Native

  • From ConsoliAds Unity Inspector you need to do the following steps:
  • Enable/Disable Admob Native
  • Set width and height
  • Select Admob Native Position.



  • To show Admob Native you need to use the following code in your desired script:
  •                             ConsoliAds.Instance.LoadNativeAd(int sceneIndex) ;
                                


  • To hide Admob Native you can use this code:
  •                             ConsoliAds.Instance.HideNativeAd();
                                

Hiding Ads

  • If you want to hide all ads
  • you will need to write the following code
  •                             ConsoliAds.Instance.hideAllAds();
                                
  • You only need to call this function once in your script and whenever user starts your application ads will not show

Using More App URL and Support Email

  • The more apps URL and support email are added in a particular brand setting.
  • When an application of that brand is configured with the unity SDK, the more apps URL and support email are available to use.
  • To access more apps URL, use
    consoliads.Instance.MoreFunURL()
    It will return the more apps URL you added in the admin panel.
  • To access support email, use
    consoliads.Instance.SupportEmail()

Implementing CallBack Events

  • ConsoliAds Implements Single CallBack Event for all Ad Networks
  • You can implement these callback events to listen to Ad Networks Impression Calls
  • In the Start() method of your script use the following code to attach your functions with ConsoliAds CallBack Events:

  •                             ConsoliAds.onInterstitialAdShownEvent += onInterstitialAdShown;
    ConsoliAds.onVideoAdShownEvent += onVideoAdShown;
    ConsoliAds.onRewardedVideoAdShownEvent += onRewardedVideoAdShown;
    ConsoliAds.onPopupAdShownEvent += onPopupAdShown;


  • An example has been given in the Sample script

Checking for ad availability

  • you can check if ad is available before showing it
  • you have to pass the scene index on which you want to check ad availability
  • this method returns a Boolean depending on availability

  •                             ConsoliAds.Instance.IsAdAvailable(sceneIndex);

Coppa compliance, child directed

  • There is a checkbox for child direct apps in unity inspector, if your app falls under coppa compliance i.e. for children under 13, you should check it
  • when you configure server with child directed check, it will update on server and can be changed from there as well

Support for unity 4.x.x

  • Unity 4 does not support subdirectories in plugins folder, Therefore, you have to relocate your files from:
    Plugins/iOS/subdirectories
    to the root of:
    Plugins/iOS
    (folder)
  • Learn more about Heyzap support for unity 4 (IOS Specific) here
  • You will not be able to use ConsoliAds Prefab in unity 4. Therefore, you have create a new Game Object in your scene and attach
    consoliads.cs
    script with it and then save that object as a prefab.

Developing for IOS

  • Set target minimum IOS version to 7.0
  • If you have made an Xcode build on a MAC, you may need to remove
    libPods.a
    file from your frameworks folder.
  • Otherwise if you have made an Xcode build on a Windows PC, you may have to perform the following steps:
  • Make sure that the following libraries and frameworks are linked to your project.
    if they are not automatically included, you need to manually add them.

  •                             libz.1.2.5.tbd
    libz.tbd
    libxml2.tbd
    libobjc.tbd
    libsqlite3.tbd

    SystemConfiguration.framework
    QuartzCore.framework
    MessageUI.framework
    MobileCoreServices.framework
    MediaPlayer.framework
    EventKitUI.framework
    EventKit.framework
    CoreData.framework
    CoreVideo.framework
    CoreMotion.framework
    CoreMedia.framework
    CoreTelephony.framework
    CoreText.framework
    CoreGraphics.framework
    AVFoundation.framework
    AVKit.framework
    AudioToolbox.framework
    AdSupport.framework
    Social.framework
    StoreKit.framework
    Webkit.framework
  • Include following library search path in your build settings:

  • $(PROJECT_DIR)/Plugins/iOS/Flurry
    $(PROJECT_DIR)/Libraries
    $(PROJECT_DIR)/Libraries/Plugins/iOS
    $(PROJECT_DIR)/Libraries/Plugins/iOS/Heyzap

  • Otherwise you may need to drag and drop the below given libraries from your project files to your project references:

  • libFlurry_6.2.0.a 
    libiPhone-lib.a
    libChartboost.a
    libHeyzapAds.a

  • Include following framework search path in your build settings

  • $(PROJECT_DIR)/Plugins/iOS/Supersonic/ 
    $(PROJECT_DIR)/Plugins/iOS

  • Otherwise you may need to drag and drop the following frameworks from your project files to your project references

  • GoogleMobileAds.framework
    Supersonic.framework