Having a problem with User ID (User ID - Analytics Platform - Matomo). The problem is that the userId (username) is associated with the visitor IP some but not all of the time.
Particulars:
-
Before our Angular.js client application bootstraps (angular.bootstrap()), we HTTP GET a json ‘user’ object which has a username (string) attribute.
-
Upon successful retrieval of the user object, Angular.js runs (module.run()) and sets the Piwik user ID:
angular.module(‘app’)
.run([
…
if(user.hasOwnProperty(‘username’)){
_paq.push([‘setUserId’, user.username]);
}
…
}])
- the weird thing is that it works some of the time but not all of the time, even though the user/username is always present.
Am I missing some async issue?
Any ideas?