[Huawei Developers] shikkerimath:
Introduction

In this article, we will learn GameAnalytics integration in Unity Game.In previous article, we learnt about some of the features provided by the GameAnalytics.In this part-2 we will implement the Huawei Ads kit, will know practivcally how GameAnalytics helps Huawei Ads events like Ad opened, Ad shown, Ad clicked and Ad failed to show, which can be easily recorded by GameAnalytics and also we will look into SourceEvents and Remote configuration, and other useful features of GameAalytics which makes easy to get custom reports on the various filters you desired.

Development Overview

You need to install Unity software and I assume that you have prior knowledge about the Unity and C#

Hardware Requirements

A computer (desktop or laptop) running Windows 10.

Android phone with API Level 21 or latest and USB cable, which is used for debugging.

Software Requirements

Java JDK 1.7 or more installation package.

Unity software version: 2020.1.15f1.4895 or latest installed.

Integration Preparations

Create Unity project.

View attachment 5315583

2. Download GameAnalytics plugin.

3. Download HMS plugin.

4. Create project in AG-Console

5. How to integrate Huawei Ads in Unity

6. Choose Assets > Import package > Custom package select GameAnalytics package file and

click OK.

View attachment 5315585

How do I trigger Ads Events?

Ads Events supports only IOS and Android. The GameAnalytics ad event needs to invoke when certain events happen for implemented ad sdk.

An ad sdk has callback methods activating code when certain things like ad show and ad click activated. GameAnalytics makes easy to capture these call-back events to be recorded one has to call GameAnalytics sdk when these delegates called.

The examples below describes how to implement this for the ad-types.

Rewarded video

Interstitial

Bannner

[ICODE]
GameAnalytics.NewAdEvent([URL='https://gaadaction.show/']GAAdAction.Show[/URL], GAAdType.Interstitial,"onAdShow", ad.getAdId());

GameAnalytics.NewAdEvent(GAAdAction.Clicked, GAAdType.Interstitial,"unityad", ad.getAdId());

GameAnalytics.NewAdEvent(GAAdAction.FailedShow, GAAdType.Interstitial, "unity ads failed to load ", ad.getAdId());
[/ICODE]

How do I trigger Impression Events?

Impression events are used to get impression data from different ad networks. Currently the following ad networks are supported:

MoPub

Fyber

IronSource

MoPub

To record impression data from MoPub, add the following code inside the Start function and the SDK will send automatically the impression events for you.

void Start ()

{

GameAnalytics.SubscribeMoPubImpressions();

}

Fyber

To record impression data from Fyber, add the following code inside the Start function and the SDK will send automatically the impression events for you.

void Start ()

{

GameAnalytics.SubscribeFyberImpressions();

}

IronSource

To record impression data from IronSource, add the following code inside the Start function and the SDK will send automatically the impression events for you.

void Start ()

{

GameAnalytics.SubscribeIronSourceImpressions();

}

How do I fetch Remote Configuration value?

GameAnalytics provides remote configuration which allows user to configure key pair values from the remote place and also it allows user to Schedule that is set start date ad end date of the configuration.

String remoteValue = GameAnalytics.GetRemoteConfigsValueAsString("Test");

View attachment 5315587

View attachment 5315589

View attachment 5315591

How can I download reports?

GameAnalytics allows you to various filter option and which makes user to predict and take decision based on the analysis report, you can download various kind of reports as show in the below image.

View attachment 5315593

View attachment 5315595

View attachment 5315597

View attachment 5315599

Result

View attachment 5315601

View attachment 5315603

View attachment 5315605

Tricks and Tips

Make sure you have downloaded latest plugin.

Make sure that GameAnalytics Object is created.

Make sure that required permissions are added in Manifest.

Conclusion

In this article, we have learnt how to integrate Huawei Ads Kit with GameAnalytics in Unity. Which proves you with the ability to create own custom events depending on what you would prefer to capture, remote configuration, Funnel and provides various filter option on report.

Thank you so much for reading, I hope this article helps you to understand the GameAnalytics features in Unity.

Reference

GameAnalytics

GameAnalytics Unity

GameAnalytics Plugin

Check out in forum