[FIX] Fixed naming, the account used in ga, and the controller.
bzr revid: vta@openerp.com-20121023151549-atepg5qan70xhmiq
This commit is contained in:
parent
4f16b71910
commit
7d15ab44f4
|
@ -32,7 +32,6 @@ Collects web application usage with Google Analytics.
|
|||
'author': 'OpenERP SA',
|
||||
'website': 'http://openerp.com',
|
||||
'depends': ['web'],
|
||||
'icon': '/web_analytics/static/src/img/icon128.png',
|
||||
'data': [],
|
||||
'installable': True,
|
||||
'active': False,
|
|
@ -11,16 +11,18 @@ class web_analytics(openerpweb.Controller):
|
|||
|
||||
# This controllers redirects virtual urls of the form /web_analytics/MODEL/VIEW
|
||||
# as provided to google by the analytics modules to a real url that openerp can
|
||||
# understand of the form /web/webclient/home/#model=MODEL&view_type=VIEW
|
||||
# understand of the form /#model=MODEL&view_type=VIEW
|
||||
# So that the user can click openerp urls inside google analytics.
|
||||
|
||||
_cp_path = "/web_analytics"
|
||||
|
||||
@openerpweb.httprequest
|
||||
def redirect(self,req):
|
||||
def redirect(self, req):
|
||||
url = req.httprequest.base_url
|
||||
suburl = url.split('/')
|
||||
suburl = suburl[suburl.index('redirect')+1:]
|
||||
|
||||
rurl = "/web/webclient/home/#"
|
||||
rurl = "/#"
|
||||
if len(suburl) >=1 and suburl[0]:
|
||||
rurl += "model="+str(suburl[0])
|
||||
if len(suburl) >=2 and suburl[1]:
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
@ -13,20 +13,21 @@ openerp.web_analytics = function(instance) {
|
|||
* web_client.do_push_state() method which is responsible of changing the openerp current url
|
||||
*/
|
||||
|
||||
|
||||
|
||||
if (instance.webclient) {
|
||||
//_gaq.push(['_setAccount', 'UA-25293939-2']); // fva@openerp.com localhost
|
||||
_gaq.push(['_setAccount', 'UA-28648768-1']); // fva@openerp.com runbot
|
||||
//_gaq.push(['_setAccount', 'UA-28648768-1']); // fva@openerp.com
|
||||
//_gaq.push(['_setAccount', 'UA-7333765-1']); // fp@openerp.com
|
||||
//_gaq.push(['_setAccount', 'UA-7333765-1']); // fp@openerp.com
|
||||
_gaq.push(['_setDomainName', '.openerp.com']);
|
||||
// _gaq.push(['_setAccount', 'UA-25293939-2']); // fva@openerp.com localhost
|
||||
// _gaq.push(['_setAccount', 'UA-28648768-1']); // fva@openerp.com runbot
|
||||
// _gaq.push(['_setAccount', 'UA-28648768-1']); // fva@openerp.com
|
||||
// _gaq.push(['_setAccount', 'UA-7333765-1']); // fp@openerp.com
|
||||
// _gaq.push(['_setAccount', 'UA-7333765-1']); // fp@openerp.com
|
||||
// _gaq.push(['_setDomainName', '.openerp.com']);
|
||||
|
||||
_gaq.push(['_setAccount', 'UA-35793871-1']); // vta@openerp.com localhost
|
||||
_gaq.push(['setDomainName', 'none']);
|
||||
_gaq.push(['_trackPageview']);
|
||||
|
||||
var connection = this.sessions.session0.connection;
|
||||
_gaq.push(['_setCustomVar',1,'Paying User',String(connection.openerp_entreprise),1]);
|
||||
_gaq.push(['_setCustomVar',2,'Admin User',String(connection.uid == 1),1]);
|
||||
// var connection = instance.session.connection;
|
||||
_gaq.push(['_setCustomVar', 1, 'Normal User', String(instance.session.uid === 1), 1]);
|
||||
_gaq.push(['_setCustomVar', 2, 'Admin User', String(instance.session.uid === 1), 1]);
|
||||
|
||||
// Google Analytics Code snippet
|
||||
(function() {
|
||||
|
@ -36,15 +37,20 @@ openerp.web_analytics = function(instance) {
|
|||
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);
|
||||
}) ();
|
||||
})();
|
||||
|
||||
instance.webclient.do_push_state.add(function(state) {
|
||||
var self = this;
|
||||
instance.webclient.on('state_pushed', self, function(state) {
|
||||
var model_whitelist = {'sale.order':'', 'purchase.order':'', 'crm.lead':''};
|
||||
var view_type_blacklist = {'default':''};
|
||||
var model = state["model"] || "no_model";
|
||||
var view_type = state["view_type"] || "default";
|
||||
var vurl = "web_analytics/redirect/"+ model + "/" + view_type
|
||||
console.log(vurl);
|
||||
_gaq.push(['_trackPageview',vurl]);
|
||||
if ((model in model_whitelist) && !(view_type in view_type_blacklist)) {
|
||||
var vurl = "web_analytics/redirect/"+ model + "/" + view_type
|
||||
console.log(vurl);
|
||||
_gaq.push(['_trackPageview',vurl]);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
};
|
Loading…
Reference in New Issue