[IMP] website: google analytic - use Automatic Cookie Domain Configuration.
authorJeremy Kersten <jke@odoo.com>
Fri, 5 Sep 2014 12:51:08 +0000 (14:51 +0200)
committerJeremy Kersten <jke@odoo.com>
Fri, 5 Sep 2014 12:51:08 +0000 (14:51 +0200)
Automatic Cookie Domain Configuration simplifies cross domain tracking implementations by automatically writing cookies to the highest level domain possible when the auto parameter is used. When used on the domain www.example.co.uk, it will try to write cookies in the following order:

co.uk
example.co.uk
www.example.co.uk
Analytics.js will fail to write a cookie on co.uk but will succeed on example.co.uk. Since a cookie was succesfully written on a higher level domain, www.example.co.uk will be skipped.

addons/website/views/website_templates.xml

index a6b91db..f7915b9 100644 (file)
                     m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
                     })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
 
-                    ga('create',_.str.trim('<t t-esc="website.google_analytics_key"/>'));
+                    ga('create', _.str.trim('<t t-esc="website.google_analytics_key"/>'), 'auto');
                     ga('send','pageview');
                 </script>
             </t>