How to use DTM to send app events to Google Analytics


This article is shared in Huawei Developer ForumHow to use DTM to send app events to Google Analytics, you can watch the video specific integration guide.

As a developer or app operator, getting users’ behavior data in app in real time is one of the daily and important tasks. For example, how can we quickly obtain the conversion data and final payment of users from all channels at each key node of the app?

adoptDynamic label Manager Service(DTM for short), you can analyze and measure the configuration of code based on the web interface, and then send the data to the third-party analysis platform, without modifying the code and publishing the app version. Take the shopping cart event as an example. In this issue, we will introduce how to send the shopping cart event to Google Analytics through DTM.

Before starting configuration, your app needs to have integrated DTM Android SDK(Link to previous issue), and Huawei analysis SDK has been used to complete the embedding of “add to shopping cart”.

1. Modify the DTM configuration and send the “add to shopping cart” event to Google Analytics.

Step 1: configure a preset variable of event name in variable management.

Step 2: create a new custom condition in condition management. When the value of event name is equal to $addproduct2cart, the matching succeeds.

Step 3: create a new code with the code type of “Google Analytics: Universal Analytics” in code management. The tracking ID uses Google Analytics’ data to track the unique ID. select the type of report and fill in the corresponding parameters. The trigger condition selects the condition created in the previous step. So far, the configuration of DTM has been modified.

Demo video

2. Verify whether 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 the mobile browser or start the preview through ADB command.

Step 2: click the add shopping cart button in the app to trigger the buried point event report, and check whether the reported event is consistent with the configuration in DTM in the “event” drop-down of “real time” in the menu bar of Google Analytics analysis platform. So far, the configuration verification of DTM is completed.

Demo video

3. Create and publish DTM version.

Next, you can release the DTM version to make the configuration effective for all apps in the current network. You need to enter the version management page to create and publish a version.

Demo video

For more details about HMS core dynamic label management service, please refer to:

Official website of Huawei developer Alliance

Get development guidance documents

Please go to reddit community to participate in developer discussion

Download the demo and sample code at GitHub

To solve the integration problem, please go to stack overflow

Learn more > >

visitOfficial website of Huawei developer Alliance
obtainDevelopment guidance document
Huawei mobile service open source warehouse address:GitHubGitee

Follow us and learn the latest technical information of HMS core at the first time~