[IMP] Change custom variable initialization in web_analytics
authorvta vta@openerp.com <>
Fri, 11 Jan 2013 13:29:44 +0000 (14:29 +0100)
committervta vta@openerp.com <>
Fri, 11 Jan 2013 13:29:44 +0000 (14:29 +0100)
bzr revid: vta@openerp.com-20130111132944-1q171v9fjtei5b36

addons/web_analytics/static/src/js/web_analytics.js

index 75bcf29..1d3efbb 100644 (file)
@@ -38,7 +38,8 @@ openerp.web_analytics = function(instance) {
         },
         /*
         * This method MUST be overriden by saas_demo and saas_trial in order to
-        * set the correct user type. By default, the user connected is local to the DB.
+        * set the correct user type. By default, the user connected is local to
+        * the DB (like in accounts).
         */
         _get_user_type: function() {
             return 'Local User';
@@ -67,17 +68,17 @@ openerp.web_analytics = function(instance) {
         * stored in GA. Also other modules can override it to add new custom variables
         */
         initialize_custom: function() {
-            // Track User Access Level, Custom Variable 4 in GA with visitor level scope
-            // Values: 'Admin User', 'Normal User', 'Portal User', 'Anonymous User'
-            _gaq.push(['_setCustomVar', 4, 'User Access Level', this.user_access_level, 1]);
-
-            // Track User Type Conversion, Custom Variable 3 in GA with session level scope
-            // Values: 'Visitor', 'Demo', 'Online Trial', 'Online Paying', 'Local User'
-            _gaq.push(['_setCustomVar', 1, 'User Type Conversion', this._get_user_type(), 2]);
-
+            var self = this;
             return instance.session.rpc("/web/webclient/version_info", {})
                 .done(function(res) {
                     _gaq.push(['_setCustomVar', 5, 'Version', res.server_version, 3]);
+                    // Track User Access Level, Custom Variable 4 in GA with visitor level scope
+                    // Values: 'Admin User', 'Normal User', 'Portal User', 'Anonymous User'
+                    _gaq.push(['_setCustomVar', 4, 'User Access Level', self.user_access_level, 1]);
+
+                    // Track User Type Conversion, Custom Variable 3 in GA with session level scope
+                    // Values: 'Visitor', 'Demo', 'Online Trial', 'Online Paying', 'Local User'
+                    _gaq.push(['_setCustomVar', 1, 'User Type Conversion', self._get_user_type(), 2]);
                     _gaq.push(['_trackPageview']);
                     return;
                 });