1

This article was shared on Huawei Developer Forum "How to use DTM to send App events to Google Analytics" , you can watch the video for specific integration instructions.

As a developer or app operator, obtaining real-time user behavior data in an app is one of the daily and important tasks. For example, how to quickly obtain the conversion data of users of various channels at various key nodes of the app and the final payment status?

Through the dynamic tag manager service (DTM for short), you can analyze and measure the configuration of the code based on the web interface, and then send the data to a third-party analysis platform without modifying the code and publishing the app version. Taking the add to cart event as an example, in this issue we will introduce how to send the add to cart event to Google Analytics through DTM.

Before starting the configuration, your app needs to have integrated the DTM Android SDK ( is linked to the previous issue of ), and the "Add to shopping cart" has been completed using the Huawei Analytics SDK.

1. Modify the DTM configuration to send the "Add to Cart" event to Google Analytics.

Step 1, configure a preset variable of Event Name in the variable management.

The second step is to create a new custom condition in the condition management. When the value of Event Name is equal to $AddProduct2Cart, the match is successful.

Step 3: Create a new code with the code type "Google Analytics (Analysis): Universal Analytics" in the code management. The tracking ID uses the data tracking unique ID of Google Analytics. Select the type of report and fill in the corresponding parameters. Select the trigger condition. The condition created in the previous step. So far, the configuration of DTM has been modified.

Demo Video

2. Verify that the DTM configuration is correct.

Step 1: Click the preview button on the overview page to enter the version preview page, scan the QR code with a mobile browser or start the preview through the adb command.

Step 2: Click the Add to Cart button in the App to trigger the reporting of the tracking event, and check whether the reported event is consistent with the configuration in the DTM in the "Event" drop-down under "Real-time" in the menu bar of the Google Analytics analysis platform. So far, the configuration verification of DTM is completed.

Demo Video

3. Create and publish a DTM version.

Next, the DTM version can be released to make the configuration take effect for all apps on the live network. You need to go to the version management page to create and publish a version.

Demo Video

For more details of HMS Core dynamic tag management service, please refer to:
https://developer.huawei.com/consumer/cn/doc/development/HMSCore-Guides/introduction-0000001050043907?ha_source=hms1

Huawei Developer Alliance official website

Get the development guidance document

participate in developer discussions, please go to the Reddit community

download the demo and sample code, please go to Github

integration issues, please go to Stack Overflow

for more details >>

Visit Huawei Developer Alliance official website
Get the development guidance document
Huawei Mobile Services open source warehouse address: GitHub , Gitee

Follow us to know the latest technical information of HMS Core for the first time~


HarmonyOS_SDK
596 声望11.7k 粉丝

HarmonyOS SDK通过将HarmonyOS系统级能力对外开放,支撑开发者高效打造更纯净、更智能、更精致、更易用的鸿蒙原生应用,和开发者共同成长。