This is a migrated thread and some comments may be shown as answers.

Setting UserID in JavaScript

1 Answer 66 Views
Monitor integration
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Atle
Top achievements
Rank 1
Atle asked on 18 Feb 2015, 02:06 PM
Hello,

We are trying to associate a different UserId, but our UserId does not seem to be honored.

This is the code we use (Trying to Set the UserID equal to the Users SID value from Active Directory)

           var settings = _eqatec.createSettings(projectKey);
            settings.version = "1.0.0";
            settings.loggingInterface = window._eqatec.createTraceLogger();
            analyticsMonitor = window._eqatecmonitor = _eqatec.createMonitor(settings);

            var sid = currentUser().sid();
            analyticsMonitor.setUserID(sid);
            analyticsMonitor.start();

Please advice how we can figure out why this is failing? Nothing is being reported anywhere.

Thanks

Atle

1 Answer, 1 is accepted

Sort by
0
Richard Flamsholt
Telerik team
answered on 18 Feb 2015, 04:40 PM
Hi Atle,

This surely could have been both documented better and have had a better runtime-warning. I've logged that task in our backlog.

The documentation doesn't explain the usage in full:

The UserID will only be used if there is no way for the monitor itself to generate and store a unique identification of this user. This is the case if either 1) you have asked to disable cookies by setting settings.useCookies to false or 2) cookies are disabled by the end-user in the browser. Only then will the monitor resort to use your provided value. In order for your UserID to take effect you could therefore choose to set useCookies to false in the settings.

The method documentation also leaves out another important point: the UserID must be a GUID-formatted string. Agree, it would be better if any string was allowed and uniquely one-way converted into a GUID by the monitor itself, but for now the passed UserID must be a GUID.

Why these obstacles, you may think? Basically, it's because this ID is almost solely used for the sake of counting uniqueness, and for that purpose the monitor provides the best uniform mechanism it can completely automatically without the implementor having to do anything. The UserID-setter is really just a last resort in case cookies are not supported.

If, on the other hand, you wish to associate the identification of a certain user (as your SID code suggests) with the registered statistics for this particular session, then it is much more useful to use another Analytics setting: the InstallationId.

I think it does just what you want the userId to do and it can be any string. You can read more about it here:
http://docs.telerik.com/platform/analytics/integration/installations/installation-id

If the InstallationId doesn't match your intentions then please write me again.

Regards,
Richard Flamsholt
Telerik
 
EQATEC Application Analytics is now Telerik Analytics. For more information on the new name, plus what's new in Telerik Analytics, please, check out the Analytics Service Announcement.
 
Tags
Monitor integration
Asked by
Atle
Top achievements
Rank 1
Answers by
Richard Flamsholt
Telerik team
Share this question
or