How to Use Game Service with MVVM / Part 3— Leaderboards & Saved Games - Huawei Developers

{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Introduction
Hello everyone, this article is third part of the Huawei Game Service blog series. In the third part, I’ve give some detail about Game Service and I’ve give information about leaderboards and saved games. Also I've explain how to use it in the your mobile game app with the MVVM structure. You can find second part of the Game Service blog series on the below.
How to Use Game Service with MVVM / Part 2— Achievements & Events
What Is Leaderboards?
Leaderboards are an effective way to drive competition among game players by displaying players’ rankings. You can create up to 70 leaderboards in AppGallery Connect. Your game can report the score of a player to one or more leaderboards you have created at specified moments (for example, when a player reaches a level or a round ends). Huawei game server automatically processes the scores of players and ranks them. Then you can call rankings APIs to display the leaderboards to your game players.
The basic functions of a leaderboard are as follows:
Huawei game server automatically checks whether a reported score of a player is better than the best score ever recorded for this player. If so, Huawei game server will update all involved leaderboards with the new score.
A game can have up to 70 leaderboards, and a leaderboard can have up to 5000 records.
Huawei game server automatically creates the daily, weekly, and all-time versions for a leaderboard. For example, the server can generate the daily, weekly, and all-time versions for a round-finishing time leaderboard of a racing game. You do not need to create a leaderboard for each time frame.
Leaderboards reset data based on the local time of the corresponding game server. For example, the China site adopts UTC+08:00. The daily leaderboard is reset at 00:00 every day, and the weekly leaderboard is reset at 24:00 on Saturday for the Europe site and at 24:00 on Sunday for other sites. A leaderboard displays only rankings of players from the same site.
If entries on your leaderboards are ranked by currency amount, you need to perform exchange rate conversion on your own. Huawei game server only ranks reported values without units.
How To Create A Leaderboard?
Leaderboards are created on the console. For this, firstly log-in Huawei AGC Console.
Select “My Apps” -> Your App Name -> “Operate” -> “Leaderboards”
In this page, you can see your leaderboards and you can create a new leaderboard by clicking “Create” button.
After clicked “Create” button, you will see leaderboard detail page. In this page you should give some information for your leaderboard. So, an leaderboard should contain the following basic attributes:
Leaderboard ID: A unique string generated by AppGallery Connect to identify a leaderboard.
Leaderboard Name: Name of a leaderboard. How to name a leaderboard is up to you.
Score: Score of a player on a leaderboard. Scores can only be uploaded by Game Service APIs upon score changes, but cannot be directly defined during leaderboard creation.
Custom Unit: For a numeric leaderboard, you can customize a unit for numbers, for example, meter or kilometer.
Icon: Icon associated with a leaderboard. The icon must be of the resolution 512 x 512 px, and in PNG or JPG format. Avoid using any texts that need to be localized in the icon.
Ordering Mode: Ordering mode of leaderboard entries. You can define whether a larger or smaller score is better. Once a leaderboard is released, the mode cannot be modified.
Limits: Lower and upper limits of scores allowed by a leaderboard. The setting can help discard scores that are clearly fraudulent. Once a leaderboard is released, the limits cannot be modified.
List Order: Order of a leaderboard among all leaderboards. You need to set this attribute when creating a leaderboard.
Multi-Language: Multi-language information of a leaderboard. You can define what languages your game supports when creating a leaderboard. You need to define the leaderboard name and custom unit (if defined) in each supported language.
Score Format: You can define the score format as any of the following when creating a leaderboard:
Currency: Displays scores in a currency format. A score value represents a currency amount.
Time: Displays scores in a time format.
Numeric: Displays scores as numbers. You can customize a unit for them.
After type all of the necessary information, click the “Save” button and save. After saving, you will be see again Leaderboards list. And you have to click “Release” button for start to using your leaderboard. Also, you can edit and see details of leaderboards in this page. But you must wait 1–2 days for the leaderboards to be approved. You can login the game with your developer account and test it until it is approved. But it must wait for approval before other users can view the leaderboards.
Displaying Scores
1. Create Score List (Leaderboard) Page
Firstly, create a Xml file, and add recyclerView to list all of the leaders. You can find my design in the below.
XML:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="70dp"
android:id="@+id/relativeLay">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Leadership"
android:textSize="25dp"
android:textAllCaps="false"
android:gravity="center"
android:textColor="#9A9A9B"
android:fontFamily="@font/muli_regular"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvFavorite"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="25dp"/>
</RelativeLayout>
Read full article.
Tips & Tricks
Remember that each leaderboard has a different ID. So, you must set the ID value of the leaderboard you want to use.
You can create diffirent leaderboards for diffirent game types.
Before calling archive APIs, ensure that the player has signed in.
Conclusion
Thanks to this article, you can create a Leaderboard on the console. Also, you can submit a score and list your leaders on your game app. Also, you can create a Saved Games, you can update and list your saved game details on your game app. You can see saved game detail logs on the below.
References
HMS Game Service
Read full article.

Related

How to Use Game Service with MVVM / Part 2— Achievements & Events

Introduction
Hello everyone. This article is second part is Huawei Game Service blog series. In the first part, I’ve give some detail about Game Service and I will give information about achievements, and events.Also I've explain how to use it in the your mobile game app with the MVVM structure.
You can find first part of the Game Service blog series on the below.
How to Use Game Service with MVVM / Part 1 — Login
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
What Is Achievement?
Achievements are a great way to increase player engagement within your game and to give players greater incentives to continue playing the game. An achievement can represent a player’s accomplishments (for example, number of defeated players or completed missions) or the skills the player has acquired. You can periodically add achievements to keep the game fresh and encourage players to continue to participate.
Achievement information must have been configured in AppGallery Connect. For details, please refer to Configuring Achievements.
Before calling achievement APIs, ensure that the player has signed in.
The device must run EMUI 10.0 or later, and have HUAWEI AppAssistant 10.1 or later installed, in order to support achievements display.
To use the achievement feature, users need to enable Game Services on HUAWEI AppGallery (10.3 or later). If a user who has not enabled Game Services triggers achievement API calling, the HMS Core SDK redirects the user to the Game Services switch page on HUAWEI AppGallery and instructs the user to enable Game Services. If the user does not enable Game Services, result code 7218 is returned. Your game needs to actively instruct users to go to Me > Settings > Game Services on AppGallery and enable Game Services, so the achievement feature will be available.
How To Create An Achievement?
Achievements are created on the console. For this, firstly log-in Huawei AGC Console.
Select “My Apps” -> Your App Name -> “Operate” -> “Achievements”
In this page, you can see your achievements and you can create a new achievement by clicking “Create” button.
After clicked “Create” button, you will see detail page. In this page you should give some information for your achievement. So, an achievement can contain the following basic attributes:
ID: A unique string generated by AppGallery Connect to identify an achievement.
Name: A short name for the achievement that you define during achievement configuration (maximum of 100 characters).
Description: A concise description of the achievement. Usually, this instructs the player how to earn the achievement (maximum of 500 characters).
Icon: Displayed after an achievement is earned. The icon must be 512 x 512 px, and in PNG or JPG format, and must not contain any words in a specific language. The HMS Core SDK will automatically generate a grayscale version icon based on this icon and use it for unlocked achievements.
Steps: Achievements can be designated as standard or incremental. An incremental achievement involves a player completing a number of steps to unlock the achievement. The predefined number of steps is known as the number of achievement steps.
List order: The order in which the current achievement appears among all of the achievements. It is designated during achievement configuration.
State: An achievement can be in one of three different states in a game.
Hidden: A hidden achievement means that details about the achievement are hidden from the player. Such achievements are equipped with a generic placeholder description and icon while in a hidden state. If an achievement contains a spoiler about your game that you would like not to reveal, you may configure the achievement as hidden and reveal it to the payer after the game reaches a certain stage.
Revealed: A revealed achievement means that the player knows about the achievement, but has not yet earned it. If you wish to show the achievement to the player at the start of the game, you can configure it to this state.
Unlocked: An unlocked achievement means that the player has successfully earned the achievement. This state is unconfigurable and must be earned by the player. After the player achieves this state, a pop-up will be displayed at the top of the game page. The HMS Core SDK allows for an achievement to be unlocked offline. When a game comes back online, it synchronizes with Huawei game server to update the achievement’s unlocked state.
After type all of the necessary information, click the “Save” button and save. After saving, you will be see again Achievement list. And you have to click “Release” button for start to using your achievements. Also, you can edit and see details of achievements in this page. But you must wait 1–2 days for the achievements to be approved. You can login the game with your developer account and test it until it is approved. But it must wait for approval before other users can view the achievements.
Listing Achievements
1.Create Achievement List Page
Firstly, create a Xml file, and add recyclerView to list all of the achievements. You can find my design in the below.
XML:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="70dp"
android:id="@+id/relativeLay"
android:layout_marginBottom="50dp">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Achievements"
android:textSize="25dp"
android:textAllCaps="false"
android:gravity="center"
android:textColor="#9A9A9B"
android:fontFamily="@font/muli_regular"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvFavorite"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="30dp"/>
</RelativeLayout>
2. Create AchievementsViewModel class
AchievementsViewModel class will receive data from View class, processes data and send again to View class.
Firstly create a LiveData list and ArrayList to set achievemets and send to View class. Create getLiveData() and setLiveData() methods.
Finally, create a client for achievements. And create a method to get all Achievements. Add all of the achievements into arrayList. After than, set this array to LiveData list.
Yo can see AchievementsViewModel class in the below.
Code:
class AchievementsViewModel(private val context: Context): ViewModel() {
var achievementLiveData: MutableLiveData<ArrayList<Achievement>>? = null
var achievementList: ArrayList<Achievement> = ArrayList<Achievement>()
fun init() {
achievementLiveData = MutableLiveData()
setLiveData();
achievementLiveData!!.setValue(achievementList);
}
fun getLiveData(): MutableLiveData<ArrayList<Achievement>>? {
return achievementLiveData
}
fun setLiveData() {
getAllAchievements()
}
fun getAllAchievements(){
var client: AchievementsClient = Games.getAchievementsClient(context as Activity)
var task: Task<List<Achievement>> = client.getAchievementList(true)
task.addOnSuccessListener { turnedList ->
turnedList?.let {
for(achievement in it){
Log.i(Constants.ACHIEVEMENT_VIEWMODEL_TAG, "turned Value : " + "${achievement.displayName}")
achievementList.add(achievement!!)
}
achievementLiveData!!.setValue(achievementList)
}
}.addOnFailureListener {
if(it is ApiException){
Log.i(Constants.ACHIEVEMENT_VIEWMODEL_TAG, "${(it as ApiException).statusCode}")
}
}
}
}
3. Create AchievementsViewModelFactory Class
Create a viewmodel factory class and set context as parameter. This class should be return ViewModel class.
Code:
class AchievementsViewModelFactory(private val context: Context): ViewModelProvider.NewInstanceFactory() {
override fun <T : ViewModel?> create(modelClass: Class<T>): T {
return AchievementsViewModel(context) as T
}
}
4. Create Adapter Class
To list the achievements, you must create an adapter class and a custom AchievementItem design. Here, you can make a design that suits your needs and create an adapter class.
5. Create AchievementsFragment
Firstly, ViewModel dependencies should be added on Xml file. We will use it as binding object. For this, open again your Xml file and add variable name as “viewmodel” and add type as your ViewModel class directory like that.
XML:
<data>
<variable
name="viewmodel"
type="com.xxx.xxx.viewmodel.AchievementsViewModel" />
</data>
Turn back AchievemetsFragment and add factory class, viewmodel class and binding.
Code:
private lateinit var binding: FragmentAchievementsBinding
private lateinit var viewModel: AchievementsViewModel
private lateinit var viewModelFactory: AchievementsViewModelFactory
Real full article
Tips & Tricks
Remember that each success and event has a different ID. So, you must set the ID value of the event or achievement you want to use.
You must wait until the approval process is complete before all users can use the achievements and events.
Conclusion
Thanks to this article, you can create event and achievement on the console. Also, thanks to this article, you can grow and list your events.
In the next article, I will explain Leaderboard, Saved Games and give an example. Please follow fourth article for develop your game app with clean architecture.
References
HMS Game Service
Read full article here

Dynamic Tag Manager: Seamless Ad Conversion Tracking

Conversion tracking can help you evaluate how effective your advertisements are, by analyzing whether user ad taps are converted into actions (such as browsing, registration, and purchase) that have tangible value to your business. It can also help you compare different channels and ad types, ensuring that you optimize ad placement, and improve the corresponding Return on Investment (ROI).
Here demonstrates how can we combine Dynamic Tag Manager (DTM) with HUAWEI Ads to provide next-level conversion tracking for ad landing pages.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
1. Creating a Conversion on HUAWEI Ads
Sign in to HUAWEI Ads, select Toolbox > Lead tracking, and click Add to create a conversion. Landing URL, Conversion goal, and DTM Conversion Name are all mandatory fields on the page that is displayed.
Notes:
l Landing URL: Enter the landing page URL to be tracked, which must be the same as that for your promotional task.
l Conversion goal: Select only one of the following conversion goals: Conversion and lifecycle, Form, Consulting, Other leads, Landing page performance, Game, Finance, and Social interaction.
l DTM Conversion Name: Enter a name related to the conversion tracking.
After entering the relevant information, click Submit to generate a conversion ID (saved for future use). Then click Using the Huawei Trace Code Manager to go to the DTM portal.
2. Configuring Tracking Tags Through DTM
If this is your first time using DTM, you can complete all necessary preparations by following the instructions in the Development Guide. After doing so, you'll be able to configure the tracking tags via DTM.
Click Create configuration, set the Configuration name and URL, and click OK. The JavaScript code will be generated. Copy the code and embed it to all web pages to be promoted (embedding is one-off and remains valid).
* Screenshots are from the test app.
Before managing related configurations, make sure that you know how to use DTM. Here is an example to help familiarize you with the operations. Let's assume that you want to track the number of user taps on the shopping cart button. You'll need to configure the conversion tracking for HUAWEI Ads into DTM. The trigger condition for the tracking is that the user taps the shopping cart button to go to the payment page. In this case, the following configurations should be implemented:
l Trigger condition: The user taps the shopping cart button, which triggers the tag to send the conversion tracking information.
l Tag: Use the built-in HUAWEI Ads conversion tracking tag and enter the conversion ID. When the trigger condition is met, the tag will be triggered to send the conversion information to HUAWEI Ads.
The detailed operations are as follows:
(1) Managing variables
l Click Variable > Configure preset variable on the DTM portal. Then select Page element > Element Text. For more information, please refer to Variable Management.
(2) Managing conditions
Click Condition > Create on the DTM portal. In the dialog box displayed, set Type to All elements, Trigger to Some clicks, Variable to Element Text, Operator to Equals, and Value to shopping cart. For more information, please refer to Condition Management.
(3) Managing tags
Configure the destination to which data is sent, after configuring the conditions for sending data. You can set HUAWEI Ads as the destination.
Click Tag > Create on the DTM portal. In the dialog box displayed, set Extension to HUAWEI Ads, Tracking ID to the above-created conversion ID, and Trigger condition to Clickshoppingcart, so that you can track the number of shopping cart button taps. For more information, please refer to Tag Management.
Conversion tracking is ready to go as soon as you have released a new configuration version. When a user taps the shopping cart button, an event will be reported to HUAWEI Ads, on which you can view the conversion data.
The evaluation of the ad conversion effects includes but is not limited to checking whether users place orders or make purchases. All expected high-value user behaviors, such as account registrations and message consulting, can be regarded as preparations for conversion. You can also add trigger conditions when configuring tags on DTM to suit your needs.
In addition, if the data provided by HUAWEI Ads does not end up helping you optimize your ad placement, after an extended period of time with an ad, you can choose to add required conditions directly via the tag management page on the DTM portal to ensure that you have a steady stream of new conversion data. This method provides for unmatched flexibility, and spares you from the need to repeatedly add event tracking. With the ability to add tracking events and related parameters via visual event tracking, you'll enjoy access to a true wealth of data.
The above is a brief overview for how DTM can help you track conversion data for landing pages. The service endows your app with powerful ad conversion tracking function, without even requiring the use of hardcoded packages.
To learn more about DTM, please visit:
l HUAWEI Developers
l Development Documentation
l Reddit to join the developer discussion
l GitHub to download the demo and sample code
l Stack Overflow to resolve integration-related issues

Web Page Conversion Tracking in HUAWEI Ads and DTM (Part 1)

More and more advertisers are using HUAWEI Ads to promote their apps or web pages in order to attract more users and increase revenue. This article introduces how to track clicks and conversion rates of ads delivered using HUAWEI Ads. HUAWEI Ads works with Dynamic Tag Manager (DTM) to help you easily track conversions on web pages, as well as ad performance.
First of all, what is ad conversion tracking?
Let's use Huawei Vmall as an example. Ads for Vmall are served by HUAWEI Ads. After a user clicks such an ad to access Vmall, user actions, such as adding products to the shopping cart and purchasing products, on one or more in-app pages in a given period (30 days in general) will be tracked.
Now, let's take a look at ad conversion.
When a user clicks an ad to access Vmall and purchases a product in Vmall, this is considered as an ad conversion because a user has been converted into a paying user.
Next, let's see how to configure conversion tracking for web pages in DTM.
You can configure conversion tracking for landing pages, across web pages, or across domains and select an appropriate tracking mode for each scenario in DTM. The configuration involves the following steps:
1. Configuration preparations
2. Conversion tracking for landing pages
3. Cross-page conversion tracking for a single domain
4. Cross-domain conversion tracking
First, you need to perform the following operations before configuring conversion tracking:
1. Register a HUAWEI ID.
2. Register a HUAWEI Ads account.
3. Embed the JavaScript code obtained from DTM into the web page to be tracked.
Procedure:
Step 1 Access AppGallery Connect and register a HUAWEI ID.
Step 2 Access HUAWEI Ads and register an account.
You can use your HUAWEI ID to register a HUAWEI Ads account.
Step 3 Embed the JavaScript code obtained from DTM into the web page to be tracked.
1. Add a web app.
Sign in to AppGallery Connect, select My projects, click Add project, enter a project name, and click OK.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Click Add app. On the page displayed, select Web for Platform, set App name, and click OK.
2. Create a configuration in DTM.
In AppGallery Connect, go to Grow > Dynamic Tag Management.
Click Enable Dynamic Tag Manager. In the dialog box displayed, set Configuration name and URL, and click OK. Embed the generated JavaScript code snippet into all web pages to be promoted. The code needs to be embedded only once and will be valid indefinitely.
Step 4 Use Google Tag Manager (GTM) to embed the DTM-Web tracking code snippet.
During version development, it is unpractical to modify the code snippet and release it to the live network immediately. So, how can the code snippet be embedded into web pages without version release?
As many web pages integrate GTM, you can use it to embed the DTM code. The detailed configuration process is as follows:
1. Sign in to GTM and select the container corresponding to the web page to track.
2. Create a tag.
Go to Tags > New. On the page displayed, set Tag Type to Custom HTML and copy the DTM code snippet to the HTML area. Set Firing Triggers to Page View, enter a tag name, and click Save.
3. Create and release a version.
Click Submit. On the page displayed, select Publish and Create Version, enter a version name, and click Publish.
You have now completed the necessary preparations for configuring conversion tracking for web pages.
To learn more, please visit:
HUAWEI Developers official website
Development Guide
Reddit to join developer discussions
GitHub or Gitee to download the demo and sample code
Stack Overflow to solve integration problems
Original Source

Finding it Difficult to Check Ad Performance? Integrate HUAWEI DTM to Effectively Check the Performance of Your Ads

Have you ever encountered the following problems when serving ads:
You allocate a large ad budget but you don't know how well your ads are performing and whether you're getting the most out of your ad spend.
You don't know what valuable actions users take when they view your ads.
You don't know whether ad serving policies such as the ad serving channel and ad type need to be adjusted.
To resolve the aforementioned problems, you'll need to track your ad conversion.
What is ad conversion tracking?
Conversion tracking is a critical part of serving ads. It is a process of reporting important conversion information (such as OAID, timestamp, conversion action, and action parameters) that advertisers care about to the ads analytics platform in order to generate reports. These reports help you quantify the performance of your ads and track the quantity and quality of users acquired by different platforms and ad types, and their corresponding conversion effects, thus helping you find ways to improve how you serve ads.
For example, when using HUAWEI Ads to serve ads, you can use HUAWEI Dynamic Tag Manager (DTM) to set conversion tracking to track ad conversion channels and analyze conversion effects with ease.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
​DTM is a tag manager system (TMS) that allows you to dynamically update tracking tags on a web-based UI to track specific events and report data to analytics platforms and ad attribution platforms. Visual event tracking in DTM is now the tool of choice for HUAWEI Ads web advertisers to track conversions on web pages.
Once you have integrated the DTM JavaScript code snippet or SDK into your app, simply configure a tracking code snippet for your web pages to collect conversion information. DTM has the following advantages when used for conversion tracking:
Fast setup: Getting DTM up and running is quick and easy: simply configure rules and add visual events to be tracked on the DTM web portal to quickly obtain data. This greatly shortens the configuration time compared with the traditional method of configuring tracking code for web pages.
High flexibility: If you need to adjust the ad serving policy or data to be collected after serving ads, all you need to do is to add related conditions on the tag management page on the DTM portal, which is more flexible and convenient because you don't need to repeat complex tracking code configuration or release an app update.
Multi-platform tracking: DTM supports conversion tracking for apps across different platforms, such as the Android and web platforms.
To configure HUAWEI Ads conversion tracking using DTM, perform the following operations. (Conversion tracking for web pages is used as an example.)
Obtain the tracking code snippet on the DTM portal and embed the code snippet into the pages to be promoted.
1. Create a conversion in HUAWEI Ads.
2. Configure conversion events in DTM and send them to HUAWEI Ads.
3. The procedure is as follows:
(You can click here to view the detailed procedure. Note that if the registration place of your ad account is in China, you need to submit a ticket online to apply to be added to the trustlist before using conversion tracking.)
A. Sign in to AppGallery Connect, obtain the tracking code snippet on the DTM portal, and embed the code snippet into the pages to be promoted.
a. In AppGallery Connect, click My projects and then Add project, enter a project name, and click OK. Then, click Add app, set Platform to Web and enter an app name, and click OK.
b. Go to Grow > Dynamic Tag Manager, click Enable Dynamic Tag Manager, enter a configuration name and URL to be promoted, and click OK. On the Install web page tracking tag page displayed, copy the code snippet and embed it into all pages to be promoted (including those on mobile phones). The code snippet needs to be embedded only once and will be valid permanently.
B. Create a conversion in HUAWEI Ads.
a. Sign in to HUAWEI Ads, go to Tools > Delivery assistance > Conversion tracking, click New conversion, select Lead tracking and then DTM, and click Continue. Set conversion information, such as Conversion actions, Conversion name, and Click attribution window.
b. Click Next. A conversion is created and its ID is generated. Record the conversion ID because it will be used for tag configuration in DTM later.
c. Configure conversion events in DTM and send them to HUAWEI Ads.
Sign in to AppGallery Connect, go to Grow > Dynamic Tag Manager, and create variables, conditions, and tags to generate a configuration or quickly complete configuration by adding visual events.
After completing configuration, you can release a configuration version for conversion tracking. Then, you can view related conversion events and data in a report in HUAWEI Ads.
In summary, DTM makes ad conversion tracking more efficient. In addition, DTM can be used for anti-fraud analysis and operations efficiency improvement. If you have any questions or would like to know more about the service, feel free to leave a message below.
To learn more about DTM, please visit:
>> DTM official website
>> DTM development guide
>> DTM codelab
If you have any questions, please submit a ticket online.
Does it support only web or both Android and Ios?
Basavaraj.navi said:
Does it support only web or both Android and Ios?
Click to expand...
Click to collapse
Hi, DTM SDK supports Android, IOS and web

Novice journey towards HMS Ads kit in Unity

{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Introduction
In this article, we will learn how to integrate Ads kit in Unity 3D application using Official Plugin (Huawei HMS AGC services). This example covers the Reward Ads.
First we will understand why we need Ads kit.
Every company makes or builds some kind of product. Building or developing is not a big deal but marketing is the big deal to earn money.
Traditional marketing
1. Putting Banners in City.
2. Advertisement in Radio or TV or newspaper.
3. Painting on the wall.
4. Meeting distributors with sample of product.
So, now let’s understand the drawback of each traditional marketing.
1. Putting Banners in City
You know in one city there will be many localities, sub localities streets, area, main roads, service roads etc. How many places you will put banners? If you consider one city only you need to put so many banners and when it comes to multiple cities and globe level. Imagine you need so many marking people across all the cities. And also think about cost. As an organization they need profit with less investment. But when they go with banner advertisement they have to spent lot of money for marketing only.
2. Advertisement in Radio or TV or newspaper
Now let’s take radio or TV advertisement and newspaper. Let’s take example in one home there are 5 people. How many TV’s will be there?
Max 1 or 2.
What about phones?
Its mobile world everyone will have phone. 5 member’s means 5 phones some times more than 5 because few people will have 2-3 phones.
There are thousands of channels. If you want to give advertisement how many channels you will give, 1 or 2 or max 10 channels you will give advertisement. Do you think all people will watch only those channels which you have provided advertisement?
Radio and newspaper also right. Nowadays who will listen radio? Now everyone is moving towards the social media. And also everybody is reading news in mobile application nobody takes newspaper because people started think about paper is waste and people are thinking about environment.
3. Painting on the wall.
How many houses you will paint? Just think about money and time. As I said earlier, think about multiple cities and multiple streets.
4. Meeting distributors with sample of product.
Meeting distributors with sample product. Do you think this will work out? No it won’t work out because all marketing person will not have same marketing knowledge. On top of that you should have to give training about product for them. Even after training about product they will miss some main key points of product while explaining distributors. If distributors are not convinced about product which is explained by marketing person straight away they will say “no to your product”.
Nowadays, traditional marketing has left its place on digital marketing. Advertisers prefer to place their ads via mobile media rather than printed publications or large billboards. In this way, they can reach their target audience more easily and they can measure their efficiency by analysing many parameters such as ad display and the number of clicks. In addition to in-app purchases, the most common method used by mobile developers to generate revenue from their application is to create advertising spaces for advertisers.
In this sense, Huawei Ads meets the needs of both advertisers and mobile developers. So what is this HMS Ads Kit, let’s take a closer look.
Now let us understand Huawei Ads.
Ads Kit leverages the vast user base of Huawei devices and Huawei's extensive data capabilities to provide you with the Publisher Service, helping you to monetize traffic. Meanwhile, it provides the advertising service for advertisers to deliver personalized campaigns or commercial ads to Huawei device users.
The video on this page introduces traffic monetization through Ads Kit, advantages of HUAWEI Ads Publisher Service, and the process for advertisers to display ads.
You can click here to watch the MOOC video about Ads Kit.
Types of Huawei Ads
Banner Ads.
Native Ads.
Rewarded Ads.
Interstitial Ads.
Splash Ads.
Roll Ads.
Banner Ads.
Banner ads are rectangular images that can occupy a spot within an app's layout, either at the top, middle, or bottom of the device screen. Banner ads refresh automatically at regular intervals. When a user clicks a banner ad, the user is redirected to the advertiser's page.
Native Ads.
Native ads can be images, text, or videos, which are less disruptive and fit seamlessly into the surrounding content to match your app design. You can customize native ads as needed.
Rewarded Ads.
Rewarded ads are full-screen video ads that allow users to view in exchange for in-app rewards.
Interstitial Ads.
Interstitial ads are full-screen ads that cover the interface of an app. Such an ad is displayed when a user starts, pauses, or exits an app, without disrupting the user's experience.
Splash Ads.
Splash ads are displayed immediately after an app is launched, even before the home screen of the app is displayed. You need to design a default slogan image for the app in advance, and ensure that the default slogan image is displayed before a splash ad is loaded, enhancing user experience.
Rolls Ads.
Roll ads are displayed as short videos or images, before, during, or after the video content is played.
Requirements
1. Unity Editor.
2. Huawei device or cloud debugging.
3. Visual Studio 2019.
Follow the steps on AppGalley.
Step 1: Create project on AppGallery.
Step 2: Add application to project.
Step 3: Add data storage location.
Step 4: Add SHA-256 fingerprint.
Follows the steps Client Side.
1. Create Unity Project
Step1: Open unity Hub.
Step2: Click NEW, select 3D, Project Name and Location.
Step3: Click CREATE, as follows:
2. Click Asset Store, search Huawei HMS Core App Services and click Import, as follows.
3. Once import is successful, verify directory in Assets > Huawei HMS Core App Services path, as follows.
4. Choose Edit > Project Settings > Player and edit the required options in Publishing Settings
5. Verify the files created in Step 4.
6. Download agconnect-services.json and copy and paste to Assets > Plugins > Android, as follows.
7. Choose Project Settings > Player and update package name as per agconnect-service.json file.
8. Open LauncherTemplate.gradle and add below line.
implementation 'com.android.support:appcompat-v7:28.0.0'Copy codeCopy code
9. Open AndroidManifest file and Add below permissions.
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>Copy codeCopy code
10. Open "baseProjectTemplate.gradle" and add lines, as follows.
maven {url 'https://developer.huawei.com/repo/'}Copy codeCopy code
11. Open "mainTemplate.gradle" and add lines like shown below.
implementation 'com.huawei.hms:ads-lite:13.4.29.303'
implementation 'com.huawei.hms:ads-consent:3.4.30.301'Copy codeCopy code
12. Create Scripts folder and create a class.
HuaweiHMSAds.cs
Result
Tips and Tricks
Add agconnect-services.json file without fail.
Add SHA-256 fingerprint without fail.
Make sure dependencies added in build files.
Conclusion
In this article, we have learnt what is Ads and why do we need Ads and advantages of ads over the traditional marketing. And also we have learnt types of Ads provided by the Huawei. We have built and run unity project which shows the reward Ads image ads and video ads.
References
HMS Ads Kit

Categories

Resources