Dynamic Tag Manager (DTM) | Android
In this article, I will mention about Dynamic Tag Manager (DTM).
First of all what is the DTM ? Let’s talk about this.
HUAWEI Dynamic Tag Manager (DTM) is a tag management system. DTM is a tool that allows you to track user movements and determine the behavior of users according to the tags you create. It is a very flexible tool.
DTM helps you manage the tracking tags of your apps.
Advantages
- Faster configuration file update
- More third-party platforms
- Free-of-charge
- Enterprise-level support and service
- Simple and easy-to-use UI
- Multiple data centers around the world
Currently, only Android apps are supported.
Let’s start to DTM integration.
1- Firstly you need to create an android project and integrate HMS Core into our project. If you do not have enough information about HMS CORE integration, I recommend reading this article. HMS Core integration
2- You need to enable the Analytics Kit in our project. Let’s go to Huawei Developer AppGallery Connect site and select our project. (Develop> Project Setting> Manage APIs) And let’s enable the Analytics Kit.
3- And then let’s add the DTM and Analytics Kit sdk to build.gradle in the app directory from Android Studio.
implementation 'com.huawei.hms:hianalytics:5.0.0.301'
implementation 'com.huawei.hms:dtm-api:4.0.4.300'
Click “Sync Now” to synchronize your project.
Follow the path to reach the DTM Configuration page. (Growing > Dynamic Tag Manager)
** Before using DTM, you need to set data storage location for your app.
In here, you need to create Configuration. This configuration refers to all DTM resources (overview, variables, conditions, tags, groups, versions)
Click Create Configuration on the DTM Portal.
After the configuration is created, click name of configuration.
Also you can edit, delete, import and export existing configuration.
On the Overview tab page, you can see the change history and operation records of variables, conditions, and tags in the current configuration version.
Variable
Variable is a placeholder. This is used in a condition or tag. For example app name etc. Currently, DTM provides 17 preset variables and 6 custom variable. Preset variable values can be obtained from the app without specifying any information. For a custom variable, you need to specify the mode to obtain its value.
Lets create preset variable. In this picture I add a preset variable. Event Name. I will use it in condition part.
In the below picture, you can see some preset variables.
To create custom variable, you need to click create button on custom variable part. Like i said before, there are 6 types of custom variables. I use type of Event Parameter.
Also you can put default value for this variable.
In the below picture, you can see some types of custom variable.
To see all detail about Variable, link
Condition
Conditions are used to trigger the tags. A tag must contain at least one trigger condition. For example when app name equal to “X”, send record.
There are 2 types of conditions.
Custom //Customizes a condition
Configuration loaded Matches // A condition when the configuration load is completed.
Lets create a condition. Click “Create ”button.
If Trigger is set to “All events”, all types of events will trigger the condition. If Trigger is set to “Some events”, you need to further specify trigger conditions for the condition.
To see all detail about Condition, link
Tag
Tag is use to track events. DTM supports Huawei Analytics and many third-party tag extension templates . And after publishing your app’s tags, you can update it in DTM. Also you can adjust tag configurations in real time.
Lets create a tag. Click Create on the Tag page.
Each extenion have different options. In this article we set Huawei Analytics. You can find from here structure of all extensions
- Select a tag extension template, and set related parameters.
- When “Add Event” is selected the app sends an additional event to HUAWEI Analytics. Also there are 2 more options. You can reach the detailed information of the other options from the link given above.
3. This part allows us to modify the original event parameter reported.
4. Used to add Trigger Condition. We can add more than one condition.
5. Used to add Exception Condition. We can add more than one condition.
When click the Save button. You will view the created tag on Tag page.
You can also edit, copy, pause and delete your tag.
Group
Non-archived items group is created in DTM. After creating a group, you should select items and click “Move To” bottom into new group that create by yourself.
Also you can create variable, condition, tag with Operation button on Group page.
Version
Used to save versions of a configuration. The created versions can be downloaded. If the version is published, it is automatically downloaded by the application.
When click name of version, you can view details. Also you can release, modify, download, delete etc.
Like i said it is a very flexible tool, you need to create a structure according to where you will use it. After these processes are finished, On the version details page download the configuration.
The default name of the downloaded file is DTM-***.json
And then you need to create the src\main\assets\containers\
directory in app folder and move the generated configuration file DTM-*******.json
to this directory.
In the next article, I will prepare a sample project using DTM.
I hope this article was useful.
Finally, you can ask the problems that you encountered from the Huawei Developer forum page and see the questions that were answered previously.