locked
Mobile App - Send and use User ID RRS feed

  • Question

  • Hi,

    In my app, I have my own logic regarding UserID. I would like to send this ID along with other telemetry information.

    I've tried setting both User.Id and User.AccountId but I don't see those value in the dashboard.

    Am I missing something?

    Thanks,

    Nico

    Friday, August 14, 2015 1:35 PM

Answers

  • Hi Nico, 

    I have tried to repro the bug by pasting the code you have mentioned below. 

    It didn't repro to me. I was able to see all the information (besides the user agent). 

    https://social.msdn.microsoft.com/Forums/getfile/754679

    Here are the steps I did:

    1. Started a new UWP Project, checking the "Show telemetry in the Windows Dev Center", and upgraded to the latest Nugets. 

    2. Added my IKey to the ApplicationInsights.config file

    3. Added a button to the MainPage.xaml and pasted this code in the button_Clicked event:

    private void button_Click(object sender, RoutedEventArgs e)

    {

        TelemetryClient telemetry = new TelemetryClient();

        telemetry.Context.User.UserAgent = "MyUserAgent";

        telemetry.Context.User.AccountId = "MyAccountID";

        telemetry.Context.Session.Id = "MySessionID";

        telemetry.Context.User.Id = "MyUserID";

        telemetry.TrackTrace("test user ID");

    }

    4. Clicked F5, pressed the button once and waited few seconds for the trace to show up. 

    Can you please share a sample project that repro the behavior you were referring to? 

    Thanks,

    Izik

    Friday, December 4, 2015 11:50 PM
    Answerer
  • When you add charts/grids the custom metrics will appear there.  If you coded custom metrics into your app they will be listed here.

    Here is a detailed documentation in how to implement and display custom metrics in Appliction Insights https://azure.microsoft.com/en-us/documentation/articles/app-insights-api-custom-events-metrics/ 


    Rami Sarieddine Technical Evangelist

    Saturday, December 5, 2015 10:43 AM

All replies

  • Can you paste the code? Which SDK are you using?

    Jakub Oleksy | Developer | Visual Studio Online

    Tuesday, August 18, 2015 9:30 PM
  • Hi Niko, Do you still have the issue?

    Anastasia

    Wednesday, September 30, 2015 10:45 PM
  • Hi Nico,

    Try also setting the UserAgent in your telemetry as well, it turns out if the UserAgent is empty user data might be dropped in some cases.


    Todd King - Application Insights team.

    Tuesday, November 17, 2015 11:26 PM
  • I'm setting the following and none of it is showing in the portal (This is from a UWP app). Instead it is showing guids for Session.Id and User.Id and I don't see UserAgent or AccountId at all. UserAgent being missing is fair enough as this isn't a web app.

    TelemetryClient telemetry = new TelemetryClient();
    telemetry.Context.User.UserAgent = "MyUserAgent";
    telemetry.Context.User.AccountId = "MyAccountID";
    telemetry.Context.Session.Id = "MySessionID";
    telemetry.Context.User.Id = "MyUserID";

    This is using:

    Microsoft.ApplicationInsights.WindowsApps v1.1.0
    Microsoft.ApplicationInsights.PersistenceChannel v1.2.3
    Microsoft.ApplicationInsights v1.2.3

    regards

    // charlie

    Monday, November 30, 2015 12:06 PM
  • Did you send an event after that code or are you basing this on the automatically collected events?

    Jakub Oleksy | Developer | Visual Studio Online

    Wednesday, December 2, 2015 12:07 AM
  • We have both Automatic and manual items tracked using telemetry.TrackTrace(customString).

    Neither have the User Id that I set in code passed to the portal, but the manually tracked TRACE events do have the correct AccountId.

    AccountId is not displayed at all for Automatically tracked events, so I assume it is not being recorded.

    Wednesday, December 2, 2015 9:58 PM
  • Have you looked in the events are part of the diagnostic search experience or are you referring to some of the overview charts?

    Jakub Oleksy | Developer | HockeyApp

    Friday, December 4, 2015 12:58 AM
  • I'm drilling into the actual events and the values are missing or not what I set.

    I'm pretty sure its a client side issue, when debugging I can see the incorrect user id in the JSON being sent to the server.

    Looks to me like the client is always overwriting my values with the one from the UserContextInitializer 

    Friday, December 4, 2015 10:00 AM
  • Hi Nico, 

    I have tried to repro the bug by pasting the code you have mentioned below. 

    It didn't repro to me. I was able to see all the information (besides the user agent). 

    https://social.msdn.microsoft.com/Forums/getfile/754679

    Here are the steps I did:

    1. Started a new UWP Project, checking the "Show telemetry in the Windows Dev Center", and upgraded to the latest Nugets. 

    2. Added my IKey to the ApplicationInsights.config file

    3. Added a button to the MainPage.xaml and pasted this code in the button_Clicked event:

    private void button_Click(object sender, RoutedEventArgs e)

    {

        TelemetryClient telemetry = new TelemetryClient();

        telemetry.Context.User.UserAgent = "MyUserAgent";

        telemetry.Context.User.AccountId = "MyAccountID";

        telemetry.Context.Session.Id = "MySessionID";

        telemetry.Context.User.Id = "MyUserID";

        telemetry.TrackTrace("test user ID");

    }

    4. Clicked F5, pressed the button once and waited few seconds for the trace to show up. 

    Can you please share a sample project that repro the behavior you were referring to? 

    Thanks,

    Izik

    Friday, December 4, 2015 11:50 PM
    Answerer
  • When you add charts/grids the custom metrics will appear there.  If you coded custom metrics into your app they will be listed here.

    Here is a detailed documentation in how to implement and display custom metrics in Appliction Insights https://azure.microsoft.com/en-us/documentation/articles/app-insights-api-custom-events-metrics/ 


    Rami Sarieddine Technical Evangelist

    Saturday, December 5, 2015 10:43 AM