diff --git a/app/coffee/modules/auth.coffee b/app/coffee/modules/auth.coffee index e8e73a41..a1a1f293 100644 --- a/app/coffee/modules/auth.coffee +++ b/app/coffee/modules/auth.coffee @@ -67,10 +67,11 @@ class AuthService extends taiga.Service "$tgConfig", "$translate", "tgCurrentUserService", - "tgThemeService"] + "tgThemeService", + "$tgAnalytics"] constructor: (@rootscope, @storage, @model, @rs, @http, @urls, @config, @translate, @currentUserService, - @themeService) -> + @themeService, @analytics) -> super() userModel = @.getUser() @@ -84,6 +85,7 @@ class AuthService extends taiga.Service @currentUserService.setUser(@.userData) else @.userData = null + @analytics.setUserId() _getUserTheme: -> return @rootscope.user?.theme || @config.get("defaultTheme") || "taiga" # load on index.jade @@ -182,7 +184,7 @@ class AuthService extends taiga.Service @._setTheme() @._setLocales() - + @analytics.setUserId() register: (data, type, existing) -> url = @urls.resolve("auth-register") diff --git a/app/coffee/modules/common/analytics.coffee b/app/coffee/modules/common/analytics.coffee index 2ad338d5..f80fbabd 100644 --- a/app/coffee/modules/common/analytics.coffee +++ b/app/coffee/modules/common/analytics.coffee @@ -59,6 +59,12 @@ class AnalyticsService extends taiga.Service @.trackPage(@.getUrl(), "Taiga") @.initialized = true + @.setUserId() + + setUserId: -> + return if not @.initialized + return if not @win.ga + @win.ga('set', 'userId', @rootscope?.user?.uuid) getUrl: -> return @location.path()