目录

The Calculation Logic of the User ID Function

HUAWEI Analytics Kit allows you to identify users in your app by user ID or device. If you want to analyze the data of the same account on different devices and platforms, or analyze the behavior of users who have signed in, you can choose to identify users by user ID.

The following example illustrates the calculation logic of the user ID function:

Assume that there are two devices: X and Y. The reported event details are as follows:

Events reported by device X: A user opened the app and performed a series of operations (steps 1 to 3) without sign-in. Then, the user used account B to sign in on the device and performed a series of operations (steps 4 to 7). Finally, the user provided device X to another user, who used account C to sign in to the device, performed a series of operations (steps 8 to 11), signed out, and used the device for a period of time (steps 12 to 13) without sign-in.

Events reported by device Y: A user opened the app on a new mobile phone and performed a series of operations (steps 14 to 16) without sign-in. Then, the user used account B to sign in on the mobile phone and performed a series of operations (steps 17 to 19).

The following table lists the event details reported by devices X and Y.

No.DeviceEventReported Device ID (AAID) Reported Account ID (User ID)User Identifier in the SystemSign-In Identifier

1

 X

App   installation

 A

 NULL

 A

 FALSE

2

 X

App   opening

 A

 NULL

 A

 FALSE

3

 X

App   operation

 A

 NULL

 A

 FALSE

4

 X

App   sign-in

 B

 NULL

 A

 FALSE

5

 X

App   operation

 B

 B

 B

 TRUE

6

 X

App   operation

 B

 B

 B

 TRUE

7

 X

App   sign-out

 B

 B

 B

 TRUE

8

 X

App   sign-in using another account

 C

 C

 C

 TRUE

9

 X

App   operation

 C

 C

 C

 TRUE

10

 X

App   operation

 C

 C

 C

 TRUE

11

 X

App   sign-out

 C

 C

 C

 TRUE

12

 X

App   operation

 A

 NULL

 A

 FALSE

13

 X

App   operation

 A

 NULL

 A

 FALSE

14

 Y

App   installation

 D

 NULL

 D

 TRUE

15

 Y

App   opening

 D

 NULL

 D

 TRUE

16

 Y

App   operation

 D

 NULL

 D

 TRUE

17

 Y

App   sign-in

 B

 B

 B

 TRUE

18

 Y

App   operation

 B

 B

 B

 TRUE

19

 Y

App   operation

 B

 B

 B

 TRUE

The calculation logic of the user ID function is as follows:

The system determines that the operations in the same session are performed by the same user. If the operations of steps 1 to 7 listed in the preceding table are performed in the same session, the system automatically supplements the AAID before sign-in with the user ID after sign-in. The supplemented user ID is used as the primary key for all subsequent metrics statistics.

The following table lists the event details after supplementation.

No.Device EventReported Device ID (AAID)Reported Account ID (User ID) User Identifier in the SystemSign-In Identifier

1

 X

App   installation

 A

NULL

 A-->B

 FALSE

2

 X

App   opening

 A

NULL

 A-->B

 FALSE

3

 X

App   operation

 A

 NULL

 A-->B

 FALSE

4

 X

App   sign-in

 B

 NULL

 A-->B

 FALSE

5

 X

App   operation

 B

 B

 B

 TRUE

6

 X

App   operation

 B

 B

 B

 TRUE

7

 X

App   sign-out

 B

 B

 B

 TRUE

8

 X

App   sign-in using another account

 C

 C

 C

 TRUE

9

 X

App   operation

 C

 C

 C

 TRUE

10

 X

App   operation

 C

 C

 C

 TRUE

11

 X

App   sign-out

 C

 C

 C

 TRUE

12

 X

App   operation

 A

 NULL

 A

 FALSE

13

 X

App   operation

 A

 NULL

 A

 FALSE

14

 Y

App   installation

 D

 NULL

 D-->B

 TRUE

15

 Y

App   opening

 D

 NULL

 D-->B

 TRUE

16

 Y

App   operation

 D

 NULL

 D-->B

 TRUE

17

 Y

App   sign-in

 B

 B

 B

 TRUE

18

 Y

App   operation

 B

 B

 B

 TRUE

19

 Y

App   operation

 B

 B

 B

 TRUE

According to the statistics result, there are three users (A, B, and C), among which two users (B and C) have signed in.