# Mobile User Tagging

**URL:** <https://community.dynatrace.com/t/mobile-user-tagging/11717>\
**Category:** Real User Monitoring\
**Tags:** mobile-monitoring, user-sessions\
**Created:** [April 26, 2018, 4:29pm UTC](https://community.dynatrace.com/t/mobile-user-tagging/11717 "2018-04-26T16:29:56Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![alejandro\_herna](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/alejandro_herna/32/10062_2.png) [@alejandro\_herna](https://community.dynatrace.com/u/alejandro_herna)\
**Post date:** [April 26, 2018, 4:29pm UTC](https://community.dynatrace.com/t/mobile-user-tagging/11717/1 "2018-04-26T16:29:56Z")

</div>

I’ve inplemented the Mobile monitoring of an Android App with command line Auto instrumentation and the client wants to identify the user with the user tagging, however I’ve never done that before and I need some advice. So far I know that I have to use the OneAgent SDK for mobile and I read in the documentation that I can add it by adding it to the dependencies with the next instruction:

dependencies {  
implementation ‘com.dynatrace.agent:agent-android:\<version\>’

}

and that I can do the tag with the instruction:

Dynatrace.identifyUser(\<usertag\>);

However is it not clear for me how to do the tag could you help me please?

Also I have inplemented the mobile monitoring with manual Instrumentation (developer) for IOS can you also tell me how to do the user tagging for IOS please.

---

<div class="post-metadata">

**Author:** ![Thomas\_Wirth1](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/thomas_wirth1/32/1776_2.png) [@Thomas\_Wirth1](https://community.dynatrace.com/u/Thomas_Wirth1)\
**Post date:** [April 27, 2018, 6:42am UTC](https://community.dynatrace.com/t/mobile-user-tagging/11717/2 "2018-04-27T06:42:51Z")

</div>

You have to add the OneAgent library as dependency to your project (in the file build.gradle) with

```auto
dependencies {
	implementation 'com.dynatrace.agent:agent-android:<version>'
}

```

, where _version_ must be the equal to the version of the auto-instrumentor. The OneAgent library is now hosted on [JCenter](https://bintray.com/bintray/jcenter/com.dynatrace.agent%3Aagent-android) and [MavenCentral](https://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.dynatrace.agent%22%20AND%20a%3A%22agent-android%22), which allows you to easily upgrade the version. But in this case we recommend to use the [Dynatrace Gradle plugin](https://www.dynatrace.com/support/help/user-experience/mobile-apps/how-do-i-use-the-dynatrace-gradle-plugin-for-android-app-auto-instrumentation/), because it automatically ensures that the version of the agent and auto-instrumentor are equal.

---

<div class="post-metadata">

**Author:** ![alejandro\_herna](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/alejandro_herna/32/10062_2.png) [@alejandro\_herna](https://community.dynatrace.com/u/alejandro_herna)\
**Post date:** [April 27, 2018, 2:17pm UTC](https://community.dynatrace.com/t/mobile-user-tagging/11717/3 "2018-04-27T14:17:39Z")

</div>

Yeah I already know that, what is not clear for me is how to apply the tag.

---

<div class="post-metadata">

**Author:** ![alejandro\_herna](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/alejandro_herna/32/10062_2.png) [@alejandro\_herna](https://community.dynatrace.com/u/alejandro_herna)\
**Post date:** [April 27, 2018, 5:34pm UTC](https://community.dynatrace.com/t/mobile-user-tagging/11717/4 "2018-04-27T17:34:49Z")

</div>

[@Patrick H.](https://answers.dynatrace.com/users/11519/view.html) Can you help me with this?

---

<div class="post-metadata">

**Author:** ![Patrick\_H](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/patrick_h/32/37540_2.png) [@Patrick\_H](https://community.dynatrace.com/u/Patrick_H)\
**Post date:** [May 2, 2018, 6:16am UTC](https://community.dynatrace.com/t/mobile-user-tagging/11717/5 "2018-05-02T06:16:49Z")

</div>

The tag is applied by using the API `Dynatrace.identifyUser(<usertag>);` where `<usertag>` is e.g. the users email address or a user id which you want to tag the session of a user.

---

<div class="post-metadata">

**Author:** ![thiago\_bien](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/thiago_bien/32/1683_2.png) [@thiago\_bien](https://community.dynatrace.com/u/thiago_bien)\
**Post date:** [June 21, 2018, 4:33pm UTC](https://community.dynatrace.com/t/mobile-user-tagging/11717/6 "2018-06-21T16:33:19Z")

</div>

@Patrick, where should the API be called/configured in the app in order to tag the session with the username?  
Should the dev add that API call right after the login code, for example?  
Only calling the API in one point of the APP will already tag the entire session successfully?

---

<div class="post-metadata">

**Author:** ![pahofmann](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/pahofmann/32/17076_2.png) [@pahofmann](https://community.dynatrace.com/u/pahofmann)\
**Post date:** [June 21, 2018, 5:56pm UTC](https://community.dynatrace.com/t/mobile-user-tagging/11717/7 "2018-06-21T17:56:28Z")

</div>

Different Patrick, but I can still help 😉

Calling identifyUser will tag the entire session. The earlier the tagging is done, the earlier the tag will be available for live session. Doing it after the login would be fine. But it also is no problem if you do it later on, as long as the point where you call the API is always executed for every user.

---

<div class="post-metadata">

**Author:** ![thiago\_bien](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/thiago_bien/32/1683_2.png) [@thiago\_bien](https://community.dynatrace.com/u/thiago_bien)\
**Post date:** [June 21, 2018, 6:39pm UTC](https://community.dynatrace.com/t/mobile-user-tagging/11717/8 "2018-06-21T18:39:21Z")

</div>

Great! Thank you, Patrick!

---

<div class="post-metadata">

**Author:** ![suresh230591](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/suresh230591/32/280_2.png) [@suresh230591](https://community.dynatrace.com/u/suresh230591)\
**Post date:** [April 17, 2019, 7:18am UTC](https://community.dynatrace.com/t/mobile-user-tagging/11717/9 "2019-04-17T07:18:52Z")

</div>

Hi,

From where we should call this API Dynatrace.identifyUser(“[john.doe@example.com](mailto:john.doe@example.com)”); Is it possible to do this from GUI.

---

<div class="post-metadata">

**Author:** ![Patrick\_H](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/patrick_h/32/37540_2.png) [@Patrick\_H](https://community.dynatrace.com/u/Patrick_H)\
**Post date:** [April 17, 2019, 8:21am UTC](https://community.dynatrace.com/t/mobile-user-tagging/11717/10 "2019-04-17T08:21:06Z")

</div>

You call it when you know which user a session should be tagged with (e.g. after login finished or after app was started and you already know which user is logged in). It has te be set on every app restart as the user tag is not persisted.  
I don’t understand the GUI part of this question… but you can call it from everywhere

---

<div class="post-metadata">

**Author:** ![ve00685603](https://avatars.discourse-cdn.com/v4/letter/v/7c8e57/32.png) [@ve00685603](https://community.dynatrace.com/u/ve00685603)\
**Post date:** [June 5, 2025, 5:41pm UTC](https://community.dynatrace.com/t/mobile-user-tagging/11717/11 "2025-06-05T17:41:50Z")

</div>

We are having ios native mobile application implemented to one of our customers. We would like to apply mobile usertag for iOS as well. Could you pls give some tips around this? Pls advise. Thanks

---

<div class="post-metadata">

**Author:** ![Patrick\_H](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/patrick_h/32/37540_2.png) [@Patrick\_H](https://community.dynatrace.com/u/Patrick_H)\
**Post date:** [June 6, 2025, 5:31am UTC](https://community.dynatrace.com/t/mobile-user-tagging/11717/12 "2025-06-06T05:31:19Z")

</div>

The documentation is here:&nbsp;[OneAgent SDK for iOS in RUM Classic — Dynatrace Docs](https://docs.dynatrace.com/docs/shortlink/ios-oneagent-sdk#tag-specific-users)  
Other than that to ensure every session is tagged, set the tag either every time a user logs in or when the app is restarted either in applicationDidFinishLaunching callback or when the authenticated user session of the app is restored.
