We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.

Only Essential Cookies
Accept All

Introduction

A variable is a placeholder used in a condition or tag. For example, the App Name variable indicates the name of an Android app.

The variable functions as follows:
  • When used in a condition, a variable defines a filter condition to specify when a particular tag is triggered, for example, triggering a tag when App Name is DTM.
  • When used in a tag, a variable captures a dynamic value, for example, the product name and price.

DTM provides preset variables which can be used to configure most tags and conditions. If preset variables cannot meet your requirements, you can also create your own custom variables. Currently, DTM provides 21 types of preset variables and 8 types of custom variables.

  • Preset variable: A special variable that is preset in the system and cannot be defined. You can obtain preset variable values from the app without specifying any information.
  • Custom variable: A variable that you customize as needed.
Expand

Category

Variable

Description

App

App ID

App ID, which must be set to the app package name.

App Name

Name of an app.

App Version Name

Name of an app version.

App Version Code

Version code of an app.

SDK Version

SDK version number.

Ad

AppLinking medium

Marketing media, which can be obtained when your app is launched or updated through App Linking.

AppLinking promotion name

Marketing task name, which can be obtained when your app is launched or updated through App Linking.

AppLinking source

Marketing channel, which can be obtained when your app is launched or updated through App Linking.

Configuration

Configuration ID

ID of a configuration.

Configuration Version

Release version of a configuration.

Device

Device ID

ID of a device.

Device IP address

IP address of a device.

Device Name

Name of a device.

Language

Language set by the user.

Limit OAID tracking

Indicates whether to enable ad tracking.

OAID

Ad identifier.

OS Version

Version of the operating system where the app is running. The value is a string, for example, 10.

Platform

Operating system (Android).

Screen Resolution

Screen resolution of the device where the app is running. The value is in Width x Height format.

HUAWEI Analytics

Event Name

Name of a triggered event.

Utilities

Random Number

Random integer ranging from 0 to 2,147,483,647.

Expand

Variable Type

Description

Branch setting

Branch variables support the following data types: integer, float, Boolean, character, array, and key-value pair. When using the Branch extension template, you can reference relevant Branch variables based on the value ranges of Branch extension template fields.

Function call

To obtain the value of a custom variable, you can set the variable type to Function call and specify the path of a class which has implemented the ICustomVariable API. During tag execution, the variable will be set to the value returned by the specified class. When configuring a Function call variable on the DTM portal, you can configure parameter values which can be used in the class for implementing APIs.

Google Analytics setting

Common parameters of Google Analytics, which facilitates reference by multiple tracker tags.

All fields in the variable will be passed to tags of Google Analytics as parameters.

Constant

You can set a constant value for a variable of this type.

Mapping table

A mapping table contains a group of key-value pairs. You can enter a key value and obtain the corresponding parameter value from the table. With the mapping table, you can make the variable value automatically change according to the input value.

The following table is a mapping table example. In the example, multiple versions of an app have been released, and the version codes are 1.0, 2.0, and 3.0 respectively. If the defined variable Version ID needs to be set to different values for different app versions, you can define the value mapping for each version in a mapping table. During tag execution, the version code is matched to obtain the variable value.

Event parameter

Event parameter, which is generally used to obtain the parameter value of the reported event from the event context during tag execution.

Installation referrer

Installation source of an app, which can be obtained when the app is launched for the first time.

User properties

User attributes, which are used to obtain the user attribute values when the tracking tag is executed. The user attribute value is set on HUAWEI Analytics. Two methods are available for creating a user attribute:

  • Method 1: Sign in to AppGallery Connect and go to HUAWEI Analytics > Management > User attributes to create a user attribute.
  • Method 2: Sign in to AppGallery Connect, go to Dynamic Tag Manager > Variable, click Create, set Type to User properties, and set User attribute key to create a user attribute.

You can set a default value for a user attribute on the DTM portal.

If no user attribute value is obtained during tag execution, the default value will be used. If no default value is set, the user attribute will be left empty when no value is obtained.

Expand

If {{App Version Code}} Is

Set {{Version ID}} To

1.0

value_version1.0

2.0

value_version2.0

3.0

value_version3.0

Search in Guides
Enter a keyword.