Victor Tabuenca (OpenERP) has proposed merging lp:~openerp-dev/openobject-addons/7.0-mail_web_analytics-vta into lp:openobject-addons/7.0.
Requested reviews: OpenERP Core Team (openerp) For more details, see: https://code.launchpad.net/~openerp-dev/openobject-addons/7.0-mail_web_analytics-vta/+merge/143111 Added Google Analytics tracking capabilities to mail module -- https://code.launchpad.net/~openerp-dev/openobject-addons/7.0-mail_web_analytics-vta/+merge/143111 Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/7.0-mail_web_analytics-vta.
=== added directory 'web_analytics_mail' === added file 'web_analytics_mail/__init__.py' --- web_analytics_mail/__init__.py 1970-01-01 00:00:00 +0000 +++ web_analytics_mail/__init__.py 2013-01-14 14:11:21 +0000 @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2009-Today OpenERP SA (<http://www.openerp.com>). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +############################################################################## + + + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: === added file 'web_analytics_mail/__openerp__.py' --- web_analytics_mail/__openerp__.py 1970-01-01 00:00:00 +0000 +++ web_analytics_mail/__openerp__.py 2013-01-14 14:11:21 +0000 @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2010-Today OpenERP S.A. (<http://www.openerp.com>). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +############################################################################## + +{ + 'name': 'Google Analytics for Mail', + 'version': '1.0', + 'description': """""", + 'author': 'OpenERP SA', + 'website': 'http://www.openerp.com', + 'depends': ['mail', 'web_analytics'], + 'installable': True, + 'js': [ + 'static/src/js/web_analytics_mail.js', + ], +} +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: === added directory 'web_analytics_mail/static' === added directory 'web_analytics_mail/static/src' === added directory 'web_analytics_mail/static/src/js' === added file 'web_analytics_mail/static/src/js/web_analytics_mail.js' --- web_analytics_mail/static/src/js/web_analytics_mail.js 1970-01-01 00:00:00 +0000 +++ web_analytics_mail/static/src/js/web_analytics_mail.js 2013-01-14 14:11:21 +0000 @@ -0,0 +1,84 @@ +openerp.web_analytics_mail = function(instance) { + + instance.web_analytics.Tracker.include({ + include_tracker: function() { + this._super(); + + instance.mail.Widget.include({ + bind_events: function() { + var self = this; + this._super(); + var mail_actions = [ + {'classname': '.oe_read', 'action': 'Done'}, + {'classname': '.oe_reply', 'action': 'Reply'}, + {'classname': '.oe_star ', 'action': 'Mark as Todo'}, + {'classname': '.oe_msg_vote', 'action': 'Like/Unlike'}, + {'classname': '.oe_post', 'action': 'Post'}, + {'classname': '.oe_full', 'action': 'Open Composer'}, + {'classname': '.oe_unread', 'action': 'Move to Inbox'}, + {'classname': '.oe_add', 'action': 'Add Attachment'}, + ]; + var classes = ('' + _.map(mail_actions, function(mail_action) { + return mail_action.classname; + })).replace(/,/g, ', '); + + this.$el.on('mousedown', classes, function (e) { + var category; + if (self.action.tag === 'mail.wall') { + category = self.action.tag; + } else { + category = self.context.default_model; + } + + var action = _.filter(mail_actions, function(mail_action) { + return e.currentTarget.className.indexOf(mail_action.classname.replace(/\./g, '')) > -1; + })[0].action; + + var url = instance.web_analytics.generateUrl({'object': category, 'action': action}); + + instance.webclient.tracker._push_event({ + 'category': category, + 'action': action, + 'label': url, + 'noninteraction': true, + }); + }); + }, + }); + + instance.mail_followers.Followers.include({ + bind_events: function() { + var self = this; + this._super(); + var follower_actions = [ + {'classname': '.oe_follower', 'action': 'Follow/Unfollow'}, + {'classname': '.oe_invite', 'action': 'Add others'}, + {'classname': '.oe_remove_follower', 'action': 'Remove Follower'}, + ]; + + var classes = ('' + _.map(follower_actions, function(follower_action) { + return follower_action.classname; + })).replace(/,/g, ', '); + + this.$el.on('click', classes, function (e) { + var category = self.view.model; + + var action = _.filter(follower_actions, function(follower_action) { + return e.currentTarget.className.indexOf(follower_action.classname.replace(/\./g, '')) > -1; + })[0].action; + + var url = instance.web_analytics.generateUrl({'object': category, 'action': action}); + + instance.webclient.tracker._push_event({ + 'category': category, + 'action': action, + 'label': url, + 'noninteraction': true, + }); + }); + }, + }); + }, + }); + +}; \ No newline at end of file
_______________________________________________ Mailing list: https://launchpad.net/~openerp-dev-gtk Post to : openerp-dev-gtk@lists.launchpad.net Unsubscribe : https://launchpad.net/~openerp-dev-gtk More help : https://help.launchpad.net/ListHelp