Display user ID in the metrics of application Insight - azure-application-insights

This page
http://azure.microsoft.com/en-us/documentation/articles/app-insights-web-track-usage-custom-events-metrics/#authenticated-users
Show how to have login information in the section "Authenticated users".
But how can I see this information in Application Insight after that

I do not see user anywhere in the custom event properties for events, it seems to be the internal field that's collected but not directly exposed in the view because most of the time this "auto-collected" user would be simply an auto-generated GUID....
You can take a look at the users summary on "Usage Analytics/Users" view as well as in Metric Explorer (just select the metrics about app users like "user accounts"...)
You should be able to search for user in the Diagnostic Search but only if you specify the user name you are looking for in the search - you'll get events/traces and so on for that particular user.
Also, you can try to submit authenticated user as a custom property on the event instead of (in addition to) the embedded property, in this case you should definitely see if as part of the properties in UI but this leads to a duplication of the value inside the event (internal + custom)...

You can make a query with Analytics. The result of your query should return a column called user_AuthenticatedId.

Related

Track login event with google analytics 4

There's already a question similar to mine, but it doesn't tackle my problem.
I'm trying to set the google tag manager to track login events in my website.
But I can't identify the action related to the login event on the tag assistant.
Here is a print of the actions when I login:
None seem to be strictly related to the login event.
I tried to track some of these actions, but they occur in many other actions.
(thus, I collect data I don't need, as if they were login events)
What of these actions is related to the login event?
How can I precisely identify the login action ?
You can automatically implement data layer events on form submissions with ListenLayer.com. In this case, you will likely need to use their Custom Forms Listener.
You have to create an account, place their script on your website, enable the Custom Forms listener and it's features and then identify your forms under the Listener's event settings. You would do this by writing a simple rule to match the CSS class, ID, or form Name element etc. (these things would exist in the <form> tag.
Here you can see I have set some rules to identify a form like this
<form class="form-container"> or <form class="listenlayer">
Publish and test on your website.
Now, when the form is submitted, the Listener will automatically push data into the data layer identifying the form and the action.
From there you would use GTM to register and read the data layer activity. I assume you know how to do that since you have the GTM debug view going, but basically you'll get a new message on the left side with an event name and you can create a Custom Event trigger in GTM and also register Data Layer Variables to use in your trigger. It's all down hill from there!
With tracking you are usually left out with two approaches :
Either you ask your developer to implement a dataLayer event on a specific action / interaction so that you can then use this as a "custom event" trigger in GTM. For instance, here, on the login success page, after the GTM snippet, the developer could invoke the following code:
dataLayer.push({ event: 'login' })
That will allow you to use 'login' as your event name in GTM custom event trigger.
As you began doing, if your developer cannot implement it, you may try to identify variables that will help you isolate that specific action / page. For instance here, maybe does your successful login page has a specific URL you could use in a page view event, targeting that specific page path.

Analytics User-ID view not tracking events

I've created a new view in Google Analytics with everything set up the same as a currently functioning one, only with the addition of User ID tracking turned ON. It's using the same property so the UA code has not changed.
I've copied over everything that I can think of from the current view to the new view. At first glance everything was working fine, page views were coming through via Real-Time correctly and matched up with the values seen in the current view.
For some reason though, the new view is not listing ANY actual events in Real-Time, however the events graph is being populated.
The current view IS tracking all the events correctly.
We use Tag Manager to handle all our events among other things, and using the debug mode, all events were also being triggered correctly. Finally, I've also used the GA Debugger chrome extension, which again is not showing any issues. The new User ID property is being passed through to analytics as I'd expect.
I've tried searching for any issues related to User ID views and tracking events, but came up blank, presumably because there is no inherent issue with this set up.
Any suggestions?
I found out that the reason that the events were not tracking is because the user id was not being sent along with every event.
I believed that once it was set on page load every analytics interaction after that would use that user id. This was not the case. In Tag manager I added a 'Field to set' property for all relevant tags like so;

Passing values that aren't related to inputs using MVC?

I have page where users can select from one or more images. When they are done I would like them to navigate to the next page and what is displayed would be based on the selection from the previous page.
"Selecting" just means that they click the image and it has a CSS class added to it. When they click the link to navigate to the next page I'd like to collect the images that have been selected and pass that information along using either TempData or Session.
In most of the examples I have seen either inputs or the query string is used to pass information from the View to the Controller. How can I pass which elements have a particular class to my controller when a link is clicked?
If you're using a link click, I'd probably just append the selected images to the query string. I'm assuming you don't mind exposing this query string to end users.
I'm sure that's probably not the answer you were looking for. But as you stated I think you're only to legitimate options are passing the values through the query string or using hidden inputs and posting the page to your action by intercepting the link click event.
You said you do not want to post back to servers. You cannot access TempData or Session without posting back to server, so they are out of scope.
You only have client side option, so you want to collect a user's selected items in array.
Once the user clicks to Next Page, you create a query string like this ?ids=1-2-3-4 and retrieve those value at next page.
Other thoughts: Long URL likes this is a bit ugly, and URL has maximum length limit depending on browser. If I'm you, I'll post back to server to collect the selected values. Then use TempData (or some persistent storage).

Track user-id in button click - google analytics

I would like to track a button click event on my wordpress site. But i want the info in such a way that how many clicks were made by a particular user. Can i pass user-id from my website and get the number of clicks for the user-ids?
I'd split this out into two areas: (1) tracking the button click, and (2) collecting data by user. For tracking the button click, I would recommend Event Tracking. For collecting data by user, I would recommend passing in a non personally identifiable user ID as a user-scoped custom dimension. Then, you'll be able to create a flat table custom report with your custom dimension and event category as dimensions, and total events as a metric. Then you can see events per user.
One additional note here, you might want to explore using the User ID feature, which allows you to measure logged in users across browsers and devices. But even if you use the User ID feature, you'll still need to use custom dimensions to see data by User ID.
I have find a solution for this. I have used event tracking to achieve this. I have used the following function in the click event of the button.
_gaq.push(['_trackEvent','button-category','Click','Clicked by the user:User id from my site']);
In the label field i pass the user id from my site. Now, i can see the clicks of a particular user using his id under Behavior->Events->Pages->Your Page->Event Category->Event Action->Event Label. As username is personally identifiable info according to google, i didn't use username.

Track a login event in Google Analytics

I would like to track a login event on my website.
The user writes username and pass then clicks on login, the form is submited and server checks if password is correct then redirect to the home page if it is.
But how could I add a Login event to GA? If I add it to the login button it wont be totally accurate as it will count even the failed login attempts.
Any ideas on how to solve this?
Thanks
Chris
Great question!
I think what you want is the Custom Variables that google analytics offers.
Simply put, for each page your user visits you set a custom variable with it's username for example.
I don't think you are interested in the login event, rather you are interested in what a logged in user visits - and this solution solves your problem
The Custom Variables answer will serve your purposes as outlined below but if you want another alternative (or actually really want to use Track Events) you could also add in a parameter to a successful logon which you can then read and process as you wish.
So for example:
Login
This will create a link to your login page. If the login is successful it will redirect back to the current page with the parameter login=true in the URL.
(You could check this parameter via JS for example and fire the Analytics track event call based on this).
One way to do this is let your login redirect to a page which says something like: "Thank you for logging in" and register this pageview to Google Analytics. And then have that page auto redirect you after 5 seconds to the page you were viewing. I've seen this done on a good amount of websites. If your login is using partial refresh you could even do it without having the user pass by a seperate page.
The simplest way is to use virtual pageviews (tutorial). It's a small piece of JS code, that you execute on any event you want. It makes GA think that there was a pageview. So you make a conditional statement like "if login == OK -> create a virtual pageview with URI "virtual/login/OK". Then you simply set this URI as a goal.
Custom Vars can be used for individual users but you need to set up a unique ID so that only you could recognise that once you pull the data out of GA. So in your dbase set a GoogleAnalyticsID against each user, then send that as a custom var to track users.

Resources