How to achieve precise advertising while protecting user privacy?

Time:2022-11-25

When users browse App pages, if pop-up advertisements that they don’t like often pop up, it will not only damage the user’s browsing experience, but also make users disgusted with the advertisement content. As an App marketer, it is very important to accurately capture user needs when placing advertisements online without arousing user resistance. When users are unwilling to authorize their personal information, such as age, gender, hobbies and other private data to the app, it is a good choice to place advertisements based on the page the user is browsing, which determines whether an advertisement can be efficiently targeted Target users.

For example, a user is reading an article in a news app about the accelerated development of new energy vehicles at this stage, the mileage has greatly increased, and cities are also accelerating the deployment of charging piles. If the targeted advertising mechanism understands the context of the article, the user will continue to browse. In the news, you may see native advertisements about test drive invitations from nearby new energy vehicle 4S stores, or advertisements about purchase discounts for a certain brand of new energy vehicles, precisely targeting the needs of target users.

HMS CoreAdvertising ServicesSupports personalized ads and non-personalized ads. Non-personalized ads are ads that are not based on the user’s past behavior. Usecontext informationOrientate. The contextual information includes the rough (such as city-level) geographical location of the current location authorized by the user, the information that comes with the device (such as the mobile phone model, etc.), and the content of the current application or the content of the current application search keyword. When a user browses a certain content in the App, or searches for a certain topic or keyword to express specific interest in the topic, the content-related advertising system will scan specific words or combinations of words, based on the content of the page the user is browsing Push ads.

Today, when data security and personal privacy are facing huge challenges, many users have great resistance to the activities of collecting personal privacy data, which means that targeted advertisements are no longer accurate. Now integrated with HMS CoreRequest ads based on contextual informationability, while protecting user privacy, it can also achieve precise delivery.

development steps

1. Prerequisites

HUAWEI Ads SDK depends on HMS Core (APK) 4.0.0.300 and above. If HMS Core (APK) 4.0.0.300 or later is not installed on the device, related interfaces of the HUAWEI Ads SDK cannot be used.

Before developing an application, it is necessary toHuawei Developer AllianceRegister as a developer on the website and complete the real-name authentication. For details, seeAccount Registration Verification

seecreate projectandAdd application under projectFinish creating the application.

2. Import HUAWEI Ads SDK

Huawei provides a Maven warehouse integration method to import the HUAWEI Ads SDK package. Before starting development, you need to integrate the HUAWEI Ads SDK into your Android Studio development environment.

Configure the Maven warehouse address.

The code base of Android Studio is configured in the Gradle pluginVersions below 7.0Version 7.0and7.1 and abovedifferent. Please select the corresponding configuration process according to your current Gradle plugin version.

3. Configure network permissions

To allow HTTP(S) network requests on mobile phones with targetSdkVersion 28 and above, do the following configuration in “AndroidManifest.xml”.

<application
    ...
    android:usesCleartextTraffic="true"
    >
    ...
</application>

4. Configure the obfuscation script

Before compiling the APK, you need to configure the obfuscation configuration file to avoid confusing the HUAWEI Ads SDK and causing abnormal functions.

Open the “proguard-rules.pro” obfuscation configuration file in the application-level root directory of the Android project, and add the obfuscation configuration that excludes the HUAWEI Ads SDK.

-keep class com.huawei.openalliance.ad.** { *; }
-keep class com.huawei.hms.ads.** { *; }

5. Initialize the SDK

In the AdSampleApplication class you can callHwAds.init(Context context)Interface to initialize the SDK or initialize the SDK in the Activity.

• It is recommended to call when the application startsHwAds.init(Context context)The interface initializes the HUAWEI Ads SDK, you need to implement it yourselfAdSampleApplicationkind.

6. Request ads based on contextual information

HUAWEI Ads SDK inAdParam.Builderprovided in the classsetContentBundlemethod for you to set the carrying context information when requesting an ad.

The sample code is as follows:

RewardAd rewardAd = new RewardAd(this, rewardId);
AdParam.Builder adParam = new AdParam.Builder();
String mediaContent = "{\"channelCategoryCode\":[\"Series\"],\"title\":[\"Journey to the West\"],\"tags\":[\"Gods and Demons\",\ "Adventure\"],\"relatedPeople\":[\"Zhang San\"],\"content\":[\"The play tells the story of four masters and apprentices learning from the West...\"],\"contentID\ ":[\"123123\"],\"category\":[\"Classic Theater\"],\"subcategory\":[\"Ancient Costume\"],\"thirdCategory\":[\"Suspense\" "]}\n";
adParam.setContentBundle(mediaContent);
rewardAd.loadAd(adParam.build(), new RewardAdLoadListener());

Learn more details>>

accessOfficial website of Huawei Developer Alliance
ObtainDevelopment Guidance Document
Huawei Mobile Services open source warehouse address:GitHubGitee

Follow us and learn about the latest technical information of HMS Core for the first time~

Recommended Today

What if you don’t want to mess with the python environment but want to automate iOS across platforms? Might as well try sib~

foreword Official website documentation (download, installation, documentation): https://sonic-cloud.gitee.io/…User community (provide bugs, requirements): https://sonic-cloud.wiki/Github: https://github.com/SonicCloud… sib introduction sib is an iOS debugging tool implemented with gidevice as the bottom layer. Because of the Go language feature, the compiled binary file can be run directly, so there is no need to configure the python environment or the […]