Novice journey towards HMS Ads kit in Unity - 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
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

Related

Huawei Cab Application Part 3 - In-App Purchase Subscription, Analytics, Native Ads

Introduction
Huawei Cab Application is to explore more about HMS Kits in real time scenario, use this app as a reference to CP during HMS integration, and they can understand easily how HMS works in real time scenario, refer previous articles:
Part1 (Login Module with Account Kit and AGC Auth Service)
Part2 (Dashboard Module with Map, Site, Location Kits and TomTom API)
Subscription Module
In-App Purchase Kit: Subscription page allows a Huawei cab user to subscribe the product from the product list and based on subscription products like Silver, Gold and Diamond. User will get benefits like remove the ads on the app, get priority support and also user will get top drivers and cars during cab booking.
Native Ad: Native ads displayed in-between cab booking history list items and removed the ads, once the user subscribes the product.
Analytics Kit: Report the subscription event details to Huawei analytics.
App Messaging: Sending promote offer for the subscribed users through app messaging.
HMS Kits Covered in Subscription Module:
1. Huawei In-App Purchase Kit
2. Huawei Native Ads
3. Huawei Analytics
4. AGC App Messaging
App Screenshots
Subscription
{
"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"
}
App Messaging
Native Ads
Huawei IAP Kit
In-App Purchases aggregates global mainstream payment methods and supports users to buy various types of virtual products and services within an app. IAP provides users with a convenient and high-quality experience and also helps developers to continuously earn revenue and create more business value globally.
Huawei IAP provides a product management system (PMS) for managing the prices and languages of in-app products (including games) in multiple locations.
Sandbox Testing
Sandbox testing allows you to complete end-to-end testing without real payments when you connect to Huawei IAP for joint commissioning. You can configure test accounts in the AppGallery Connect and allow these testers to perform sandbox testing.
Before testing, you need to add test accounts, which are real HUAWEI IDs, under Users and permissions in the AppGallery Connect. For details, refer to Managing Tester Accounts.
Huawei Native Ads
The Native Ad API allows you to build a customized experience for the ads you show in your app. When using the Native Ad API, instead of receiving an ad ready to be displayed, you will receive a group of ad properties such as a media content, ad title, ad source, call to action, and you will have to use them to construct a custom view where the ad is shown.
You will also get dislike this ad, rating, etc.
Huawei Analytics Kit
Huawei Analytics Kit is a one-stop data analysis platform for mobile app developers that utilizes data to drive daily app operations, bringing out dynamic details in a comprehensive, timely, and efficient manner. These cutting-edge solutions inspire out-of-the-box app service innovations, helping developers and operations personnel grow revenue and expand the reach of their apps.
Events: An event refers to the behaviour of a user with regard to a product, or in other words, a specific event is something that a user completes at a specific time point, place, and manner.
Real Time Example: Take the process of browsing for a typical item on a cab booking platform, as an example. Corresponding events can include tapping the registration button, accessing the product details app, and exiting the page. Therefore, event monitoring is, in essence, the detailed study of user behaviour within an app.
Huawei In-App Messaging
Huawei In-App Messaging is one of the simplest tools, but it is super useful to keep your active users. The service promotes them to keep using the app by sending messages that enhance or promote certain features of your app.
Note: Merchant Service
1. Choose Console > Developer center > Settings > Merchant Service.
2. You need to activate the IAP service for the first time, Huawei will ask for your bank account information and tax information for the payment.
3. Finally click submit. Verification of this information will take approximately 1-2 days.
Integration Preparations
You must complete the following preparations to Integrate Huawei IAP, Analytics, Ad Kits and AGC App Messaging.
Create an app in the AppGallery Connect.
Create a project in Android Studio.
Generate a signing certificate.
Generate a signing certificate fingerprint.
Configure the signing certificate fingerprint.
Add the app package name and save the configuration file.
Add the AppGallery Connect plug-in and the Maven repository in the project-level build.gradle file.
Configure the signature file in Android Studio.
Configuring the Development Environment.
Enabling Huawei IAP, Analytics, Ad Kits and App Messaging
1. Sign in to AppGallery Connect, select My apps, click an app, and choose Develop > Overview > Manage APIs.
2. Choose Earning > In-App Purchases. If it is the first time that you use Huawei In-App Purchases (IAP), click Settings.
3. Once configuration is successful, the page displays the public key used for subsequent payment signature verification and a parameter for configuring the subscription notification URL.
4. Choose Huawei Analytics > Project overview and Enable Analytics Service.
5. Choose Growing > App Messaging and Enable.  
Configuration
1. IAP: Configure Product Information. Click the Operate tab. Choose Product Operation > Product Management from the navigation tree on the left, click the Products tab, and click Add Product.
Select Default currency and Default price (tax included) of the product and Save.
Activate the product in operation column from the product list.
2. Creating an App Message. Choose Growing > App Messaging > New.
Enter Name and Description for your in-app message.
Select Type as Image and Provide Image URL.  
Select the App package and select sending target. This section is used to set conditions for matching target users.
For more information, you can visit https://forums.developer.huawei.com/forumPortal/en/topicview?tid=0202367598227240326&fid=0101187876626530001

HUAWEI Analytics Kit + App Linking: a One-Stop Solution for User Acquisition, Retention, and Activation

As mobile Internet continues to grow while user attention spans continue to shrink, it is becoming increasingly important for app developers and operations personnel to find effective ways to direct users to specific in-app content or pages with a single tap.
A real-life example of this would be delivering app install ads to various channels, and then redirecting users to an in-app activity page when users open the app for the first time after downloading it so as to improve the activity participation rate.
Another example would be sending SMS messages containing links that direct users to a specific page in the app if they have installed the app. However, if a user has not installed the app, the download page will be displayed instead, and once the user downloads and installs the app, they will be taken to the specified activity page when they open the app for the first time. This function helps increase user acquisition and activation, enhance conversion, and reduce user churn.
Analytics Kit, together with App Linking, not only makes the preceding examples a reality, but also collects and analyzes a wide range of ad performance data for all channels, thereby helping you maximize user acquisition, activity, and retention.
What are Analytics Kit and App Linking?
Analytics Kit is a one-stop industry-based solution for products such as Android apps, iOS apps, web apps, and quick apps. Applicable to a wide range of devices, it offers scenario-specific data collection, management, analysis, and usage, helping enterprises achieve effective user acquisition, product optimization, precise operations, and business growth.
{
"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"
}
App Linking is a cross-platform service provided by HMS Core, and allows you to create deep links which take users to specific pages in your app. It is applicable to scenarios such as ad delivery, targeted user activation, and content sharing.
The following gives you some examples about how Analytics Kit can be used synergistically with App Linking.
l Analyzing app installation sources and measuring user acquisition performance of each channel
You can take advantage of Analytics Kit to track app installation sources, and use App Linking to enable one-tap access to specific pages in your app. In this way, you'll be able to know which channels outperform others in terms of user acquisition, which helps enhance your acquisition and conversion rates.
* Data for reference only
To be more specific, you can use App Linking to create an app promotional link containing UTM parameters, and deliver the link to various marketing channels. When users download your app through the link and open the app for the first time, the Analytics SDK will automatically collect the link tap events and generate an analysis report. You can then adjust your ad delivery strategy according to data contained in the report, such as the real-time number of link taps, number of users who tap the link, and number of new users acquired by each marketing channel and task.
l Efficiently winning back users
Acquiring new users is often a challenge, and you may find that shifting to a strategy of winning back inactive users provides much better results.
Analytics Kit, in conjunction with App Linking, can help you do this in three easy steps:
1. First, use the user revisit report to identify the turning point when users change from inactive users to lost users, and reasonably define inactive and lost users.
2. Second, use session path analysis, audience analysis, channel analysis, and user lifecycle analysis to create a profile for inactive and lost users. This reveals the behavioral characteristics of users before they became inactive or churned, and whether they tend to come from specific channels.
3. Lastly, use this information to determine which group of users should be won back first, select appropriate winback strategies and activities, and use other services such as Push Kit and SMS to target these users by sending them deep links created using App Linking.
l Adopting viral marketing to facilitate user activation and retention
Viral marketing can be used to improve both user activation and new user acquisition by leveraging the power of social media.
For example, you can design a coupon activity which encourages existing app users to forward the activity to social media in order to obtain coupons. Non-users who tap the activity link will then be redirected via deep linking to the app activity page or download page. From here, they can perform operations such as downloading the app, helping existing users obtain the coupon, forwarding the link to others, or making in-app purchases. This can facilitate user activation and at the same time attract new users.
After that, you can utilize Analytics Kit's retention analysis, page analysis, and session path analysis features to compare the changes in retention before and after the activity was conducted, and analyze the characteristics of users' behavior paths in your app, laying a foundation for subsequent review and optimization.
For more details, you can go to:
l Our official website
l Our Development Documentation page, to find the documents you need
l Reddit to join our developer discussion
l GitHub to download demos and sample codes
l Stack Overflow to solve any integration problems
lDemo of Analytics Kit
lAndroid SDK integration documentation
liOS SDK integration documentation
lWeb SDK integration documentation
lQuick app SDK integration document
Original Source

How do I integrate HMS to my game using HMS Unity Plugin 2.0? — Part 3

{
"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
Before I begin, if you are not coming to this article from the Part 2 of the series, you can read here. If you have not seen part 1 either, you can click here. This is the third part of our HMS Unity Plugin 2.0 integration guide. This time I will be talking about in-app purchases, i.e. IAP. In the part 2 of the series, I already integrated many kits to my simple game but one important element has been missing: IAP. I will integrate IAP so that users can spend money on items in my app and you can make revenue out of your game.
I will, again, try to keep it brief and use a simple scenario. I will be implementing two types of products. One of which is a consumable and the other is a non-consumable. As you might now, in IAP, there are three main categories, two of which I already have given the names of and the third is subscription. All of them are self explanatory; for example, a consumable is a coin that can be spent and re-bought, a non-consumable is a premium membership that can be bought once and will not be lost, and a subscription is a subscription to a music or video service.
Since my game is simple, to try out more than one category, I use “heart” as a consumable purchase and “remove ads” as a non-consumable purchase. That is, since my game has hearts on the left upper corner to track how many lives of the player is left, I add an in-app purchase to buy one heart. Also, since I use ads, I will use a remove ads purchase option and if the user buys it, I will remove the ads from the game.
Let’s get started!
IAP​Before going into coding phase, there are important things that you should do.
Sandbox Testing​After I am done with the whole IAP process, I will have to test whether I implemented everything right. However, since this is IAP, I would need a credit card and purchase every time in real money, even for test purposes. This is not optimum because then, I would need funds and the refunding process takes a bit long for testing.
Huawei offers “Sandbox Testing” for this type of scenario. You need to configure a sandbox testing account for the account that you use to publish your game in App Gallery. For all the details, please click here. This is not essential for IAP to work but it is a very useful feature for testing. I strongly suggest you configure this before testing. I will not talk about the details here but the link should have it all.
Merchant Account and Other Settings​IAP requires a merchant account in the App Gallery side. For the general walkthrough in official docs please check here. For the merchant account, you can check here. Naturally, for the money you earn to be transfered to your account, you would need to provide your bank details to App Gallery. Links have the details and from now on, I will assume you have completed these steps, so we can code together in peace.
Coding Phase​Let’s get to coding in our app. You need to determine your specific scenario where you want to implement IAP and which kind of products you will offer to your users. I already talked about my scenario, so let me show you how I configured my app to implement that process.
Implementing a Pause Menu​I added a pause menu to my game so that whenever users want to buy additional hearts to survive longer or to remove the a-bit-annoying ads, they can do so by pausing the game. I added button to that menu and implemented button clicks to direct them to App Gallery UI for IAP and then to grant them what they just bought.
Now that my pause menu is ready, I need button clicks. But before that, just like achievements in part 2, I need to add my products to the App Gallery Connect. Plugin will help me get those products easily thanks to its IAP tab in HMS Settings menu. So, before adding some button clicks let’s go to AGC and add our products.
Adding Products to AGC​What you first should do is to go to AGC console by clicking here, sign in and then go to My Apps and then choose your game. You will be directed to “Distribute” tab. From the left-upper bar, choose “Operate” tab instead. There, you will have “Product Management” tab opened at first, which is where you will add your products.
Click add product on the right-upper corner and enter the details of the product that you think is suitable for your own game. Please also consider the scenario where and when you will allow your users to buy this product because it can slightly change your product details.
My remove_ads example can be seen above. I very simply provided a name and explanation. The most important thing here is the product ID because I will reach our product from the game using that ID.
Adding Products to Plugin​After I add both of my products, now it is time to set up the plugin constant class. For my case it may look redundant because the IDs of my game is short and there are only two of them anyway, so they are easy to remember. However, plugin is designed to help all kinds of developers, also to those who may have over a thousand IAP products in their apps. It basically provides ease of use.
So, I open the HMS Settings from the Huawei tab in Unity editor.
You simply should select the type of the product and enter its ID. ID must match the ID that you used in AGC. You can also import all your products, if you already have a game on Google Play Store by downloading the report and importing it to HMS Unity Plugin 2.0.
“Initialize on Start” will call certain functions at the beginning of your app and make the IAP ready for you. If you tick the box, you do not have to worry about the IAP initializations that are normally required, plugin will do it for you.
In a scenario where you do not want this to be your default behaviour (for instance, in cases of huge load on Start() function etc.), you can leave it unchecked because it is also possible to manually initialize IAP service. For this please refer here, the official readme of the plugin. There are just a few things that you should do. If you do them, you should be good to go and use the IAP as usual.
And that’s it for the HMS Settings part. Now to code in C#.
Implement Button Clicks and Callbacks​What is left to do is to implement the button clicks for purchasing the products. But also, implementing a success callback is a must because that callback is where I will implement my post-purchase logic. It may differ from one app to another, so I will show you my logic and you can infer what to for your own case.
In a separate script, or in a script that you think is suitable, I need to first register to callback. Since I have the plugin on my side, we do not have to deal with anything else, especially if you ticked the “Initialize On Start” box. The products will be retrieved from AGC in the backend, so what you should just do is to call purchasing functions.
Code:
void Start()
{
//...
HMSIAPManager.Instance.OnBuyProductSuccess = OnBuyProductSuccess;
}
public void BuyProduct(string id)
{
HMSIAPManager.Instance.BuyProduct(id);
}
In the code above, I registered to success callback and made a function call my actual function to buy the product. I did it this way to implement a button click but normally one line code as shown below is enough:
Code:
HMSIAPManager.Instance.BuyProduct(HMSIAPConstants.remove_ads);
I also should add the callback, where I will implement my post-purchase logic.
Code:
[HideInInspector]
public bool isAdsRemoved = false;
private void OnBuyProductSuccess(PurchaseResultInfo obj)
{
string myProductId = obj.InAppPurchaseData.ProductId;
//Implement your own logic here... The following is my logic
if(myProductId.Equals("heart"))
{
GameObject.Find("Player").GetComponent<Player>().health++;
GameObject.Find("Player").GetComponent<Player>().updateHealthDisplay();
} else if (myProductId.Equals("remove_ads"))
{
isAdsRemoved = true;
}
}
In the success callback, assuming that I have no server side implementations, I will get my product id to see which product the user has purchased. The rest is completely up to you because it is where you implement your own logic.
What I did is, if the user has purchased a heart, I increment his health by one and update the health display on canvas.
If the purchased product is remove ads, I set my boolean variable to true. I use this wherever I show ads to user in an if check, so if the user has purchased the “remove_ads” product, s/he will not see the ads in my game.
Tips & Tricks​
Normally, a non-consumable product, once purchased, cannot be purchased again. However, in Huawei Sandbox Testing, you are able to purchase the non-consumable (remove ads in my case) product again.
If you are unsure about whether you successfully registered in the sandbox testing environment, you can try purchasing a product in-game. You will be directed to IAP UI and before you can try to buy anything, you should see a warning message, like below, if you are in sandbox testing. If you do not see anything and the app wants a credit card, then, your sandbox testing process is failed and you are advised the visit the steps again.
Conclusion​That’s it we successfully integrated IAP to our game together! The users will be able to do in-app purchases in the game and we can even start making money!
If you have completed other two parts of this article series too, your game is now empowered with Huawei’s powerful kits and that is with the ease of low development cost, thanks to HMS Unity Plugin 2.0.
I hope that this article series have been helpful for you. You can always ask questions below, if you have anything unanswered in your mind.
Good luck on the store and see you in my other articles!
References​
IAP Official Documentation
Sandbox testing environment setup
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

How to Target Ads Precisely While Protecting User Privacy

Background​
When using an app, if pop-up ads keep appearing when we browse app pages but we are not interested in the advertised content, not only will our browsing experience be negatively affected, but we will also quickly become tired of the advertised content. Unwanted ads are usually annoying. Aimless ad targeting and delivery will result in the wrong ads being sent to users and cause poor ad performance.
So, as publishers, how do we guarantee that we can deliver ads to audiences who will be interested in them and how can we decrease users' resistance to advertising? The answer is to collect information about the user requirements of your target audiences or to really know them, and to do so in a way that causes the least annoyance. But when a user is unwilling to share their personal data, such as age, gender, and interests, with my app, placing an ad based on the page that the user is browsing is a good alternative.
For example, a user is reading an article in a news app about the fast-paced development of electric vehicles, rapidly improving battery technology, and the expansion of charging stations in cities. If the targeted advertising mechanism understands the context of the article, when users continue to read news articles in the app, they may see native ads from nearby car dealerships for test driving electric vehicles or ads about special offers for purchasing electric vehicles of a certain brand. In this way, user interests can be accurately discovered, and publishers can perform advertising based on the keywords and other metadata included in the contextual information of the app page, or any other content users are reading or watching, without having to collect users' personal information.
But I can't integrate these features all by myself, so I started searching for tools to help me request and deliver ads based on the contextual information on an app page. That's when I had the great fortune to discover Ads Kit of HMS Core. Ads Kit supports personalized and non-personalized ads. Personalized ad requests require users to grant the app access to some of their personal information, which may not be palatable for some users. Non-personalized advertising, however, is not constrained by this requirement.
Non-personalized ads are not based on users' past behavior. Instead, they target audiences using contextual information. The contextual information includes the user's rough geographical location (such as city) authorized by the user, basic device information (such as the mobile phone model), and content of the current app or search keyword. When a user browses a piece of content in your app, or searches for a topic or keyword to express a specific interest, the contextual ad system scans a specific word or a combination of words, and pushes an ad based on the page content that the user is browsing.
Today, data security and personal privacy requirements are becoming more and more stringent. Many users are very hesitant to provide personal information, which means that precise ad delivery is becoming harder and harder to achieve. Luckily, Ads Kit requests ads based on contextual information, enabling publishers to perform ad delivery with a high degree of accuracy while protecting user privacy and information.
Now let's take a look at the simple steps we need to perform in order to quickly integrate Ads Kit and perform contextual advertising.
Integration Steps​
1. Ensure that the following prerequisites are met before you integrate the Ads Kit:
HMS Core (APK) 4.0.0.300 or later should be installed on devices. If the APK is not installed or an earlier version has been installed, you will not be able to call the APIs of the Ads Kit.
Before you begin the integration process, make sure that you have registered as a Huawei developer and completed identity verification on HUAWEI Developers.
Create a project and add an app to the project for later SDK integration.
2. Import the Ads SDK.
You can integrate the Ads SDK using the Maven repository.
That is, before you start developing an app, configure the Maven repository address for Ads SDK integration in your Android Studio project.
The procedure for configuring the Maven repository address in Android Studio is different for Gradle plugin versions earlier than 7.0, Gradle plugin 7.0, and Gradle plugin versions 7.1 and later. Configure the Maven repository address accordingly based on your Gadle plugin version.
3. Configure network permissions.
To allow apps to use cleartext HTTP and HTTPS traffic on devices with targetSdkVersion 28 or later, configure the following information in the AndroidManifest.xml file:
Code:
<application
...
android:usesCleartextTraffic="true"
>
...
</application>
4. Configure obfuscation scripts.
Before building the APK, configure the obfuscation configuration file to prevent the SDK from being obfuscated.
Open the obfuscation configuration file proguard-rules.pro in your app's module directory of your Android project, and add configurations to exclude the SDK from obfuscation.
Code:
-keep class com.huawei.openalliance.ad.** { *; }
-keep class com.huawei.hms.ads.** { *; }
5. Initialize the SDK.
You can initialize the SDK in the activity, or initialize the SDK by calling the HwAds.init(Context context) API in the AdSampleApplication class upon app launch. The latter method is recommended, but you have to implement the AdSampleApplication class by yourself.
6. Request ads based on contextual information.
The SDK provides the setContentBundle method in the AdParam.Builder class for you to pass contextual information in an ad request.
The sample code is as follows:
Code:
RewardAd rewardAd = new RewardAd(this, rewardId);
AdParam.Builder adParam = new AdParam.Builder();
String mediaContent = "{\"channelCategoryCode\":[\"TV series\"],\"title\":[\"Game of Thrones\"],\"tags\":[\"fantasy\"],\"relatedPeople\":[\"David Benioff\"],\"content\":[\"Nine noble families fight for control over the lands of Westeros.\"],\"contentID\":[\"123123\"],\"category\":[\"classics\"],\"subcategory\":[\"fantasy drama\"],\"thirdCategory\":[\"mystery\"]}\n";
adParam.setContentBundle(mediaContent);
rewardAd.loadAd(adParam.build(), new RewardAdLoadListener());
Conclusion​Nowadays, advertising is an important way for publishers to monetize their apps and content, and how to deliver the right ads to the right audiences has become a key focus point. In addition to creating high quality ads, significant efforts should be placed on ensuring precise ad delivery. As an app developer and publisher, I was always searching for methods to improve ad performance and content monetization in my app. In this article, I briefly introduced a useful tool, Ads Kit, which helps publishers request ads based on contextual information, without needing to collect users' personal information. What's more, the integration process is quick and easy and only involves a few simple steps. I'm sure you'll find it useful for improving your app's ad performance.
References​Development Guide of Ads Kit

Categories

Resources