npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

com.azerion.ads

v2.1.0-preview.4

Published

AzerionAds SDK has been designed to give developers options for showing Ads from ImproveDigital, AdMob and AppLovin.

Downloads

35

Readme

How to integrate Azerion Ads Unity package

  • Add scoped registries in Edit -> Project Settings -> Package Manager -> Add Scoped Registry
    • Add npm registry for azerion ads

      Name: Azerion
      URL: http://registry.npmjs.com
      Scope(s): com.azerion.ads
    • AzerionAds Unity package has a indirect dependency of EDM4U which need to be resolved using UPM.

      Name: package.openupm.com
      URL: https://package.openupm.com
      Scope(s): com.google.external-dependency-manager
  • Update Packages/manifest.json
    {
      "dependencies": {
          "com.azerion.ads": "2.1.0-preview.1"
      }
    }

Configure AdMob App ID

Android

  • Add Custom Main Manifest for android via Project Settings->Player->Publish Settings
  • Add AppLovin App ID in Assets/Plugins/Android/AndroidManifest.xml
    <application>
        <activity android:name=".MainActivity"/>
        ...
  <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID"
             android:value="YOUR_AdMob_APP_ID"/>
        ...
    </application>

iOS

  • Create a NAME_Dependencies.xml file with required AzerionAdsAbmobAdapter adapter dependency in editor folder.
<dependencies>
    <iosPods>
        <iosPod name="AzerionAdsAbmobAdapter" version="~> 1.0.2-preview.1" bitcodeEnabled="true" addToAllTargets="false" />
    </iosPods>
</dependencies>
  • After exporting the xcode project add GADApplicationIdentifier in your info.plist file.
<key>GADApplicationIdentifier</key>
  <string>YOUR-ADMOB-APPID-HERE</string>

Configure AppLovin App ID

Android

  • Add Custom Main Manifest for android via Project Settings->Player->Publish Settings
  • Add AppLovin App ID in Assets/Plugins/Android/AndroidManifest.xml
    <application>
        <activity android:name=".MainActivity"/>
        ...
        <meta-data android:name="applovin.sdk.key"
            android:value="YOUR_APPLOVIN_APP_ID"/>
        ...
    </application>

NOTE During pre-build and post-build we check AdMob App Id configuration. So if you didn't configure it then during building project plugin will throw exception in console and display the configuration dialog.

iOS

  • Create a NAME_Dependencies.xml file with required AzerionAdsAppLovinAdapter adapter dependency in editor folder.
<dependencies>
    <iosPods>
        <iosPod name="AzerionAdsAppLovinAdapter" version="~> 1.0.0" bitcodeEnabled="true" addToAllTargets="false" />
    </iosPods>
</dependencies>
  • After exporting the xcode project add AppLovinSdkKey in your info.plist file.
<key>AppLovinSdkKey</key>
  <string>YOUR-APPLOVIN-APPID-HERE</string>

Configure iOS Project

After exporting the iOS Xcode project you need to add SKAdNetworkItems key with SKAdNetworkIdentifier values. For google AdMob it is cstr6suwn9.skadnetwork and you must have to add additional buyers identifier.


<key>SKAdNetworkItems</key>
<array>
    <dict>
        <key>SKAdNetworkIdentifier</key>
        <string>cstr6suwn9.skadnetwork</string>
    </dict>
    <array>

Dependency management

For dependency resolution we are using External Dependency Manager for Unity(EDM4U).

For Android dependency management

  • Open the file baseProjectTemplate.gradle file in Assets/Plugins/Android. If you don't have such a file, go to Project Settings->Player->Publishing Settings and enable the baseProjectTemplate gradle option.
  • Add or merge the following section.
    allprojects {
        ...
        repositories {
          google()
          jcenter()
          flatDir {
            dirs "${project(':unityLibrary').projectDir}/libs"
          }
          mavenCentral()
          maven { 
            url "https://jitpack.io" 
          }
        }
    }
  • Add mainTemplate.gradle. Go to Project Settings->Player->Publishing Settings and enable the mainTemplate gradle option. Add the following dependencies
dependencies {
    ...
    implementation 'com.azerion:azerion-sdk-ads-core:2.1.0'
    implementation 'com.azerion:azerion-sdk-ads-unity-android-adapter:1.0.0'
    // If we want to mediate ad from AdMob
    implementation 'com.azerion:azerion-sdk-ads-mediation-admob:2.1.0'
    //If we want to mediate ad from AppLovin
    implementation 'com.azerion:azerion-sdk-ads-mediation-applovin:1.0.0'
    ...
**DEPS**}

iOS Dependency Management

Install cocoapods in your Mac using following command:

$ sudo gem install cocoapods

Enable cocoapods integration from

Assets --> External Dependency Management --> iOS Resolver --> Settings

Create a NAME_Dependencies.xml file with required adapter dependencies if needed.

Create the SDK default ad config

Android

At runtime SDK downloads the ad configuration for the app based on thePackage Name. You can create a offline default ad configuration file for the app via AzerionAds -> Configuration -> Android -> Create configuration options. What it does that behind the scene it download the current snapshot of the SDK config for this app from backend and create the default_azerion_sdk_config.json file in /Assets/Azerion/Ads/Editor/Configuration/Android directory. Whenever SDK failed to fetch the ad configuration from backend it will use the offline default ad config for ad serving.

Initialize Azerion Ads SDK

public class AzerionAdsController : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        // Initialize the Azerion Ads SDK.
        var settings = new Settings(withUserConsent:false, gdprConsentString:"", isCoppaCompliant:false, isTestModeEnabled:true, isDebugModeEnabled:true);
        Debug.Log("Start Initializing the Azerion Ads SDK");
        AzerionAds.Initialize(HandleInitCompleteAction, settings);
    }

    private void HandleInitCompleteAction(InitializationStatus initializationStatus)
    {
        // ImproveDigital, AdMob adapters status
        foreach (KeyValuePair<string, AdapterStatus> adapterStateEntry in initializationStatus.getAdapterStatusMap())
        {
            Debug.Log("AdapterName: " + adapterStateEntry.Value.Name + " AdapterStatus: " +
                      adapterStateEntry.Value.InitializationState);
        }
    }
    ...
  }

NOTE You can only request Ad after SDK successfully finished initialization.

Banner Ad

public class AzerionAdsController : MonoBehaviour
{
  private BannerAd _bannerAd;
  ...
  private void RequestBannerAd()
    {
        var adUnitId = "22358747";
        _bannerAd?.Destroy();

        // Create a Smart banner at bottom of the screen
        _bannerAd = new BannerAd(adUnitId, AdSize.BANNER, AdPosition.Bottom);

        // Add Event Handlers
        _bannerAd.OnAdLoaded += (sender, args) =>
        {
            Debug.Log("Ad Loaded");
            // Show the banner ad 
            _bannerAd?.Show();
        };
        _bannerAd.OnAdFailedToLoad += (sender, args) =>
        {
            Debug.Log("errorCode: " + args.ErrorCode + " message: " + args.Message + " errorContext: " +
                      args.ErrorContext);
        };
        _bannerAd.OnAdClosed += (sender, args) => { Debug.Log("OnAdClosed"); };
        _bannerAd.OnAdDisplayed += (sender, args) => { Debug.Log("Ad Displayed"); };
        _bannerAd.OnAdFailedToDisplay += (sender, args) =>
        {
            Debug.Log("errorCode: " + args.ErrorCode + " message: " + args.Message + " errorContext: " +
                      args.ErrorContext);
        };

        _bannerAd.OnAdHide += (sender, args) => { Debug.Log("OnAdHide"); };

        _bannerAd.OnAdLeftApplication += (sender, args) => { Debug.Log("OnAdLeavingApplication"); };

        // Load a banner ad
        _bannerAd.LoadAd();
    }
    ...
}

Interstitial Ad

public class AzerionAdsController : MonoBehaviour
{
    private InterstitialAd _interstitialAd;
    ...
    private void RequestInterstitial()
    {
        if (_interstitialAd == null)
        {
            string adUnitId = "22371036";
            _interstitialAd = new InterstitialAd(adUnitId);
            // Add Event Handlers
            _interstitialAd.OnAdLoaded += (sender, args) =>
            {
                Debug.Log("_interstitialAd Loaded");
            };
            _interstitialAd.OnAdFailedToLoad += (sender, args) =>
            {
                Debug.Log("errorCode: " + args.ErrorCode + " message: " + args.Message + " errorContext: " +
                          args.ErrorContext);
                // If you want to load another ad
                 RequestInterstitial();
            };
            _interstitialAd.OnAdClosed += (sender, args) =>
            {
                Debug.Log("OnAdClosed");
                // If you want to load another ad
                RequestInterstitial();
            };
            _interstitialAd.OnAdDisplayed += (sender, args) =>
            {
                Debug.Log("Ad Displayed");
            };
            _interstitialAd.OnAdFailedToDisplay += (sender, args) =>
            {
                Debug.Log("errorCode: " + args.ErrorCode + " message: " + args.Message + " errorContext: " +
                          args.ErrorContext);
                 // If you want to load another ad
                 RequestInterstitial();
            };
            _interstitialAd.OnAdLeavingApplication += (sender, args) => { Debug.Log("OnAdLeavingApplication"); };
        }
        Debug.Log("Loading Interstitial Ad");
        _interstitialAd.Load();
    }
    ...
}

Destroy the interstitial ad when you no longer needed it.

        _interstitialAd?.Destroy();
        _interstitialAd = null;

Rewarded Ad

public class AzerionAdsController : MonoBehaviour
{
    private RewardedAd _rewardedAd;
    ...
    private void RequestRewardVideo()
    {
        string adUnityId = "22328044";
        if (_rewardedAd == null)
        {
            _rewardedAd = new RewardedAd(adUnityId);
            // Add Event Handlers
            _rewardedAd.OnAdLoaded += (sender, args) =>
            {
                Debug.Log("Ad Loaded");
            };
            _rewardedAd.OnAdFailedToLoad += (sender, args) =>
            {
                Debug.Log("errorCode: " + args.ErrorCode + " message: " + args.Message + " errorContext: " +
                          args.ErrorContext);
                // If you want to request another rewarded ad
                RequestRewardVideo();
            };
            _rewardedAd.OnAdClosed += (sender, args) =>
            {
                Debug.Log("OnAdClosed");
                // If you want to request another rewarded ad
                RequestRewardVideo();
            };
            _rewardedAd.OnAdDisplayed += (sender, args) => { 
                Debug.Log("Ad Displayed");
            };
            _rewardedAd.OnAdFailedToDisplay += (sender, args) =>
            {
                Debug.Log("errorCode: " + args.ErrorCode + " message: " + args.Message + " errorContext: " +
                          args.ErrorContext);
                // If you want to request another rewarded ad
                RequestRewardVideo();
            };
            _rewardedAd.OnAdLeavingApplication += (sender, args) => { Debug.Log("OnAdLeavingApplication"); };
            _rewardedAd.OnUserRewardEarned += (sender, args) =>
            {
                if (args != null)
                {
                    Debug.Log("OnUserRewardEarned reward amount: " + args.Amount);
                }
                else
                {
                    Debug.Log("OnUserRewardEarned");
                }
                OnUserRewardEarned(args);
            };
        }
        _rewardedAd.Load();

    }
    ...
}

Destroy the rewarded ad when you no longer needed it.

        _rewardedAd?.Destroy();
        _rewardedAd = null;

AdMob FullScreen Ad Scaling Issue on Android

If you use the following resolution and presentation setting in your game then you may face the above problem, because by default AdMob use Translucent theme for it's AdActivity which allow see through.

To solve this problem you have to override the Translucent behaviour of the AdActivity Here are the steps you need to follow

  • Add Custom Main Manifest

  • Override Translucent behaviour of the AdActivity


<manifest package="com.unity3d.player" xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools">
    ...
    <application>
        ...
        <activity
                android:name="com.google.android.gms.ads.AdActivity"
                android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
                tools:replace="android:theme"/>
        ..
    </application>
</manifest>

Known android build issues and solution

  • If you are targeting android api level 30 you may face the following issue

    AAPT: error: resource android:attr/lStar not found.
    

    To solve this issue add launcherTemplate.gradle from Project Settings -> Publishing Settings -> Custom Launcher Gradle Template Add the following configuration into launcherTemplate.gradle

    ...
    configurations.all {
        resolutionStrategy {
            force 'androidx.core:core:1.6.0'
        }
    }
  • Kotlin module issue

    More than one file was found with OS independent path 'META-INF/annotation-experimental_release.kotlin_module'

    Please add the following config into launcherTemplate.gradle

    android {
        ...
        packagingOptions {
            exclude("META-INF/*.kotlin_module")
        }
        ...
    }
  • If you are using firebase-analytics please update it version to 21.0.0