Add user id to analytics if provided in jwt

This commit is contained in:
yanas
2017-11-28 20:57:13 -06:00
committed by Дамян Минков
parent 2306e26287
commit a9b8f49995
2 changed files with 10 additions and 5 deletions

View File

@@ -35,20 +35,21 @@ export function initAnalytics({ getState }: { getState: Function }) {
return;
}
const config = getState()['features/base/config'];
const state = getState();
const config = state['features/base/config'];
const { analyticsScriptUrls } = config;
const machineId = JitsiMeetJS.getMachineId();
const { user } = state['features/base/jwt'];
const handlerConstructorOptions = {
product: 'lib-jitsi-meet',
version: JitsiMeetJS.version,
session: machineId,
user: `uid-${machineId}`,
server: getState()['features/base/connection'].locationURL.host
user: user ? user.id : `uid-${machineId}`,
server: state['features/base/connection'].locationURL.host
};
_loadHandlers(analyticsScriptUrls, handlerConstructorOptions)
.then(handlers => {
const state = getState();
const permanentProperties: Object = {
roomName: state['features/base/conference'].room,
userAgent: navigator.userAgent