Using Dynamic Tag Manager(DTM) in Flutter Projects

Efnan Akkuş
Huawei Developers
Published in
4 min readAug 17, 2020

In this article, we’ll learn how to use DTM in our Flutter projects.

Flutter is a free and open-source mobile UI framework. It allows you to create a native mobile application with only one codebase. This means that you can use one programming language and one codebase to create two different apps for iOS and Android. In this case, we’ll integrate the Dynamic Tag Manager (DTM) into a Flutter project. With Dynamic Tag Manager, you can dynamically update tracking tags on a web-based UI to track specific events and report data to third-party analytics platforms, tracking your marketing activity data as needed.

Configure your project on AppGallery Connect

Registering a Huawei ID

You need to register a Huawei ID to use the plugin. If you don’t have one, follow the instructions here.

Preparations for Integrating HUAWEI HMS Core

First of all, you need to integrate Huawei Mobile Services with your application. I will not get into details about how to integrate your application but you can use this tutorial as step by step guide.

Configuring the AndroidManifest.xml File

Process

1. Enabling Flutter Analytics Plugin

In Flutter you are advised to integrate HUAWEI Analytics Kit for recording custom events. The Flutter Analytics Plugin enables communication between HUAWEI Analytics SDK and Flutter platform. This plugin exposes all functionality provided by HUAWEI Analytics SDK. Let’s start by integrating Flutter Analytics Plugin to our pubspec.yaml file. There are two ways to do this. For both ways, after running pub get command, the plugin is ready to use.

2. Operations on the Server

To access the DTM portal, perform the following steps: On the Project Setting page, go to Growing > Dynamic Tag Manager.

Click Create configuration on the DTM portal and set Configuration name, App type, Operation record, and Tracked data.

View the configuration on the Configuration management page. You can click its name to access the configuration page.

The configuration is a general term for all resources in DTM, including Overview, Variable, Condition, Tag, Group, Version, and Visual Event.

On the Overview tab page, you can view the change history and operation records of variables, conditions, and tags in the current configuration version.

A variable is a placeholder used in a condition or tag. DTM provides preset variables which can be used to configure most tags and conditions. You can also create your own custom variables.

Creating a Preset Variable

Creating a Custom Variable

Condition

A condition is the prerequisite for triggering a tag and determines when the tag is executed. A tag must contain at least one trigger condition.

Creating a Condition

Tag

A tag is used in your app to track events. DTM supports the HUAWEI Analytics and custom function templates, as well as many third-party tag extension templates. With DTM, you do not need to add additional third-party tracking tags in your app.

Creating a Tag

Create and Release a Version

Downloading a Version

Importing a Configuration File

3. Configuring the Code

Results:

Through the Verification process, we successfully integrated Dynamic Tag Manager into Flutter project.

--

--