From b2220945896bb9f343840d19b8d2821467e22d48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Wed, 15 Jun 2016 10:30:23 +0200 Subject: [PATCH] [REM] web_analytics Too many problems for not enough gain... --- addons/web_analytics/__init__.py | 1 - addons/web_analytics/__openerp__.py | 21 -- addons/web_analytics/i18n/web_analytics.pot | 16 - addons/web_analytics/models/__init__.py | 3 - addons/web_analytics/models/ir_http.py | 9 - .../web_analytics/static/description/icon.png | Bin 3219 -> 0 bytes .../static/src/js/web_analytics.js | 292 ------------------ addons/web_analytics/views/web_analytics.xml | 10 - 8 files changed, 352 deletions(-) delete mode 100644 addons/web_analytics/__init__.py delete mode 100644 addons/web_analytics/__openerp__.py delete mode 100644 addons/web_analytics/i18n/web_analytics.pot delete mode 100644 addons/web_analytics/models/__init__.py delete mode 100644 addons/web_analytics/models/ir_http.py delete mode 100644 addons/web_analytics/static/description/icon.png delete mode 100644 addons/web_analytics/static/src/js/web_analytics.js delete mode 100644 addons/web_analytics/views/web_analytics.xml diff --git a/addons/web_analytics/__init__.py b/addons/web_analytics/__init__.py deleted file mode 100644 index bff786c0885..00000000000 --- a/addons/web_analytics/__init__.py +++ /dev/null @@ -1 +0,0 @@ -import models diff --git a/addons/web_analytics/__openerp__.py b/addons/web_analytics/__openerp__.py deleted file mode 100644 index 5f917ff2940..00000000000 --- a/addons/web_analytics/__openerp__.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. -{ - 'name': 'Google Analytics', - 'version': '1.0', - 'category': 'Tools', - 'complexity': "easy", - 'description': """ -Google Analytics. -================= - -Collects web application usage with Google Analytics. - """, - 'website': 'https://www.odoo.com/page/website-builder', - 'depends': ['web'], - 'data': [ - 'views/web_analytics.xml', - ], - 'installable': True, - 'active': False, -} diff --git a/addons/web_analytics/i18n/web_analytics.pot b/addons/web_analytics/i18n/web_analytics.pot deleted file mode 100644 index 43dab069227..00000000000 --- a/addons/web_analytics/i18n/web_analytics.pot +++ /dev/null @@ -1,16 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 9.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-09-07 14:41+0000\n" -"PO-Revision-Date: 2015-09-07 14:41+0000\n" -"Last-Translator: <>\n" -"Language-Team: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Plural-Forms: \n" - diff --git a/addons/web_analytics/models/__init__.py b/addons/web_analytics/models/__init__.py deleted file mode 100644 index 8d297897934..00000000000 --- a/addons/web_analytics/models/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# -*- coding: utf-8 -*- - -import ir_http diff --git a/addons/web_analytics/models/ir_http.py b/addons/web_analytics/models/ir_http.py deleted file mode 100644 index ce11f5823fc..00000000000 --- a/addons/web_analytics/models/ir_http.py +++ /dev/null @@ -1,9 +0,0 @@ -from openerp import models, service - -class Http(models.Model): - _inherit = 'ir.http' - - def session_info(self): - result = super(Http, self).session_info() - result['version_info'] = service.common.exp_version() - return result diff --git a/addons/web_analytics/static/description/icon.png b/addons/web_analytics/static/description/icon.png deleted file mode 100644 index b43dbe04cd06fbf3ea1de866323846f616c2718c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3219 zcmV;E3~cj>P)Px&08mU+MF0Q*00025ude_A00000!otD;0000000000 z0000C3=DH~bF#9s4h{~6hK8J+oB#j-VPRp($;n$=TUS?C00019US7@3%>V!ZnVFdY z005SjmJSXMu&}U;i;JbDrDJ4dlarGY5)uFa000004-XH8g@phB00000f`Wnq0s^kC zu4iXw00000000RI38to|RaI300000003jhESXfw5QBh)IVmCK892^{`rlzc{tPBhc z1W{-NS8xPQWCdn|0Uaf?v$F$5SOi;j1XgYXG(!S1K(Mi~02v_#V}ArsW&}rCt*xyE zVS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QeZiu}0Jc-0jP0SkD*i zfMlgG8m>(wHr1I0n$}0-w@bQ8y1K;xipAX}B_+4--y1CN?yjsn0acZidBM+L0*s;7 z3Yth1A?`^YHfcC_?v9mrb#=9hF%x*@x9{E?uLTdqDgw%6_Q4x6n4y< z$78kST{R{RR#RSHUVG%aJ z2^x*~tj{9wEAjf%#y*`+mkvc&R2U3u7%Qa3Qdc-^VaxftisM*v`*fc%J=tvR>Cr_; zm!*l#A7O@Hhg93bkSCGFiU8z@2tR+bxO5T&6~7FM<<(gd^j`|uB1S) z1Sk;Tj>!421#&hIOr{zpo-hb|JFSKan4QPtDS5#Nc23rJGUcIsIqr*nuqf>Vvco|^ zp`o}~;FxNq5{Ap|?QN^?5C*eYEC3-^hjr3yO=rqOLSd_Mr|p4f0Hi#ekLGwhmJqPc zsfk`;FvKD#tFzv0HM98g8S$)7>>_XI;I{Bw7L8F z`MIO23h)yO{U#o?sd!2?lcmHN+3btr`;Ku3p)%R&)B`O+Y@A$a{}J@;L0 zZHe1^?4ND|nDUt#~eGWUP5*7F)H-X%&F~d>8r)=?~B!v3H10 zL@lsvkCWsndgBI17q`_YGFG~*dv^18-@EYE+8^ZxW zH^;S`zxD0!yiE0l`F(kAU!2#M=Joxp&uwsYTTO$nesk;VZ#@5`KD~6$zw!FkO*U|) zi{tuNU)!|lx#hI!wapvW(Mw*9o3eKO`e&EX`t@tq**3+=0dE@@7suu0;$pjP;P(V> z?A0rm*=j%>s9zN%otzw&84xr#=U4i_@9BT_J?($2PXHAI83;j=obdnv002ovPDHLk FV1j5&q@@4= diff --git a/addons/web_analytics/static/src/js/web_analytics.js b/addons/web_analytics/static/src/js/web_analytics.js deleted file mode 100644 index f3764493634..00000000000 --- a/addons/web_analytics/static/src/js/web_analytics.js +++ /dev/null @@ -1,292 +0,0 @@ - -var _gaq = _gaq || []; // asynchronous stack used by google analytics - -odoo.define('web_analytics.web_analytics', function (require) { -"use strict"; - -var ActionManager = require('web.ActionManager'); -var CrashManager = require('web.CrashManager'); -var core = require('web.core'); -var FormView = require('web.FormView'); -var Session = require('web.Session'); -var session = require('web.session'); -var View = require('web.View'); -var web_client = require('web.web_client'); -var WebClient = require('web.WebClient'); - -/* -* The Web Analytics Module inserts the Google Analytics JS Snippet -* at the top of the page, and sends to google an url each time the -* openerp url is changed. -* The pushes of the urls is made by triggering the 'state_pushed' event in the -* web_client.do_push_state() method which is responsible of changing the openerp current url -*/ - -// Google Analytics Code snippet -(function() { - var ga = document.createElement('script'); - ga.type = 'text/javascript'; - ga.async = true; - ga.src = ('https:' === document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; - var s = document.getElementsByTagName('script')[0]; - s.parentNode.insertBefore(ga,s); -})(); - -var Tracker = core.Class.extend({ - /* - * This method initializes the tracker - */ - init: function(webclient) { - var self = this; - self.initialized = $.Deferred(); - _gaq.push(['_setAccount', 'UA-7333765-1']); - _gaq.push(['_setDomainName', '.openerp.com']); // Allow multi-domain - self.initialize_custom(webclient).then(function() { - webclient.on('state_pushed', self, self.on_state_pushed); - self.include_tracker(); - }); - }, - /* - * 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 (like in accounts). - */ - _get_user_type: function() { - return 'Local User'; - }, - /* - * This method gets the user access level, to be used as CV in GA - */ - _get_user_access_level: function() { - if (!session.session_is_valid()) { - return "Unauthenticated User"; - } - if (session.uid === 1) { - return 'Admin User'; - } - // Make the difference between portal users and anonymous users - if (session.username.indexOf('@') !== -1) { - return 'Portal User'; - } - if (session.username === 'anonymous') { - return 'Anonymous User'; - } - return 'Normal User'; - }, - - /* - * This method contains the initialization of all user-related custom variables - * stored in GA. Also other modules can override it to add new custom variables - * Must be followed by a call to _push_*() in order to actually send the data - * to GA. - */ - initialize_custom: function() { - _gaq.push(['_setCustomVar', 5, 'Version', session.version_info.server_version, 3]); - this._push_customvars(); - this.initialized.resolve(this); - return this.initialized; - }, - - /* - * Method called in order to send _setCustomVar to GA - */ - _push_customvars: function() { - var self = this; - // 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._get_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]); - }, - - /* - * Method called in order to send _trackPageview to GA - */ - _push_pageview: function(url) { - _gaq.push(['_trackPageview', url]); - }, - /* - * Method called in order to send _trackEvent to GA - */ - _push_event: function(options) { - _gaq.push(['_trackEvent', - options.category, - options.action, - options.label, - options.value, - options.noninteraction - ]); - }, - /* - * Method called in order to send ecommerce transactions to GA - */ - _push_ecommerce: function(trans_data, item_list) { - _gaq.push(['_addTrans', - trans_data.order_id, - trans_data.store_name, - trans_data.total, - trans_data.tax, - trans_data.shipping, - trans_data.city, - trans_data.state, - trans_data.country, - ]); - _.each(item_list, function(item) { - _gaq.push(['_addItem', - item.order_id, - item.sku, - item.name, - item.category, - item.price, - item.quantity, - ]); - }); - _gaq.push(['_trackTrans']); - }, - /* - * This method contains the initialization of the object and view type - * as an event in GA. - */ - on_state_pushed: function(state) { - // Track only pages corresponding to a 'normal' view of OpenERP, views - // related to client actions are tracked by the action manager - if (state.model && state.view_type) { - // Track the page - var url = generateUrl({'model': state.model, 'view_type': state.view_type}); - this._push_event({ - 'category': state.model, - 'action': state.view_type, - 'label': url, - }); - this._push_pageview(url); - } - }, - /* - * This method includes the tracker into views and managers. It can be overriden - * by other modules in order to extend tracking functionalities - */ - include_tracker: function() { - var t = this; - // Track the events related with the creation and the modification of records, - // the view type is always form - FormView.include({ - init: function(parent, dataset, view_id, options) { - this._super.apply(this, arguments); - var self = this; - this.on('record_created', self, function(r) { - var url = generateUrl({'model': self.model, 'view_type': 'form'}); - t._push_event({ - 'category': self.model, - 'action': 'create', - 'label': url, - 'noninteraction': true, - }); - }); - this.on('record_saved', self, function(r) { - var url = generateUrl({'model': self.model, 'view_type': 'form'}); - t._push_event({ - 'category': self.model, - 'action': 'save', - 'label': url, - 'noninteraction': true, - }); - }); - } - }); - - // Track client actions - ActionManager.include({ - ir_actions_client: function (action, options) { - var url = generateUrl({'action': action.tag}); - t._push_event({ - 'category': action.type, - 'action': action.tag, - 'label': url, - }); - t._push_pageview(url); - return this._super.apply(this, arguments); - }, - }); - - // Track button events - View.include({ - do_execute_action: function(action_data, dataset, record_id, on_closed) { - var category = this.model || dataset.model || ''; - var action; - if (action_data.name && _.isNaN(action_data.name-0)) { - action = action_data.name; - } else { - action = action_data.string || action_data.special || ''; - } - var url = generateUrl({'model': category, 'view_type': this.view_type}); - t._push_event({ - 'category': category, - 'action': action, - 'label': url, - 'noninteraction': true, - }); - return this._super.apply(this, arguments); - }, - }); - - // Track error events - CrashManager.include({ - show_error: function(error) { - var hash = window.location.hash; - var params = $.deparam(hash.substr(hash.indexOf('#')+1)); - var options = {}; - if (params.model && params.view_type) { - options = {'model': params.model, 'view_type': params.view_type}; - } else { - options = {'action': params.action}; - } - var url = generateUrl(options); - t._push_event({ - 'category': options.model || "ir.actions.client", - 'action': "error " + (error.code ? error.message + error.data.message : error.type + error.data.debug), - 'label': url, - 'noninteraction': true, - }); - this._super.apply(this, arguments); - }, - }); - }, -}); - -// ---------------------------------------------------------------- -// utility functions -// ---------------------------------------------------------------- - -var generateUrl = function(options) { - var url = ''; - var keys = _.keys(options); - keys = _.sortBy(keys, function(i) { return i;}); - _.each(keys, function(key) { - url += '/' + key + '/' + options[key]; - }); - return url; -}; - -// kept for API compatibility -var setupTracker = function(wc) { - return wc.tracker.initialized; -}; - -WebClient.include({ - bind_events: function() { - this._super.apply(this, arguments); - this.tracker = new Tracker(this); - }, -}); - -Session.include({ - session_authenticate: function() { - return $.when(this._super.apply(this, arguments)).then(function() { - web_client.tracker._push_customvars(); - }); - }, -}); - -}); diff --git a/addons/web_analytics/views/web_analytics.xml b/addons/web_analytics/views/web_analytics.xml deleted file mode 100644 index 0c6d07b3476..00000000000 --- a/addons/web_analytics/views/web_analytics.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - -