[IMP] Add support for Google Analytics
authorddm@openerp.com <>
Tue, 21 Jan 2014 16:34:56 +0000 (17:34 +0100)
committerddm@openerp.com <>
Tue, 21 Jan 2014 16:34:56 +0000 (17:34 +0100)
bzr revid: ddm@openerp.com-20140121163456-i3v3a7oh8qejc9oo

addons/website/models/website.py
addons/website/static/src/js/website.seo.js
addons/website/views/website_templates.xml
addons/website/views/website_views.xml

index 8303220..3bc8ee4 100644 (file)
@@ -117,6 +117,7 @@ class website(osv.osv):
         'social_linkedin': fields.char('LinkedIn Account'),
         'social_youtube': fields.char('Youtube Account'),
         'social_googleplus': fields.char('Google+ Account'),
+        'google_analytics_key': fields.char('Google Analytics Key'),
         'public_user': fields.function(_get_public_user, relation='res.users', type='many2one', string='Public User'),
         'menu_id': fields.function(_get_menu, relation='website.menu', type='many2one', string='Main Menu',
             store= {
index 7898b96..8588b7a 100644 (file)
         canEditDescription: false,
         canEditKeywords: false,
         maxTitleSize: 65,
-        maxDescriptionSize: 160,
+        maxDescriptionSize: 150,
         start: function () {
             var self = this;
             var $modal = self.$el;
index e256b42..0d23a9c 100644 (file)
                     </div>
                 </footer>
             </div>
+            <t t-if="website.google_analytics_key">
+                <script>
+                    (function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]=
+                    function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date;
+                    e=o.createElement(i);r=o.getElementsByTagName(i)[0];
+                    e.src='//www.google-analytics.com/analytics.js';
+                    r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));
+                    ga('create','<t t-esc="website.google_analytics_key"/>');ga('send','pageview');
+                </script>
+            </t>
         </body>
     </html>
 </template>
index d9445e0..23fd062 100644 (file)
@@ -51,6 +51,7 @@
                                 <field name="social_linkedin" placeholder="http://www.linkedin.com/company/openerp"/>
                                 <field name="social_youtube" placeholder="http://www.youtube.com/channel/HCU842OHPPNrQ"/>
                                 <field name="social_github" placeholder="https://youraccount.github.io"/>
+                                <field name="google_analytics_key" placeholder="UA-XXXXXXXX-1"/>
                             </group>
                             <group string="Other Info">
                                 <field name="company_id" groups="base.group_multi_company"/>