Thanks for your help Theodoros! Worked a treat.
Jake
From: Theodoros Theodoropoulos
Posted: 25/10/2012 13:50
Subject: Google Analytics
From: Theodoros Theodoropoulos
Posted: 25/10/2012 13:50
Subject: Google Analytics
Hello Jake,
I'm using the following code: (replace XXXXXXXXX with your code)
out += """
<!-- Google analytics -->
<script type="text/_javascript_">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXXX']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type =
'text/_javascript_'; ga.async = true;
ga.src = "" == document.location.protocol ? 'https://ssl' :
'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>
"""
just before the "return out" statement of the tmpl_pagefooter function
in webstyle_templates.py
I'm not sure that it's the optimal way to do it, but it works :)
Oh, and you'll have to wait approx 1 day to see the first results in
Googly Analytics!
Best regards,
Theodoros
I'm using the following code: (replace XXXXXXXXX with your code)
out += """
<!-- Google analytics -->
<script type="text/_javascript_">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXXX']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type =
'text/_javascript_'; ga.async = true;
ga.src = "" == document.location.protocol ? 'https://ssl' :
'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>
"""
just before the "return out" statement of the tmpl_pagefooter function
in webstyle_templates.py
I'm not sure that it's the optimal way to do it, but it works :)
Oh, and you'll have to wait approx 1 day to see the first results in
Googly Analytics!
Best regards,
Theodoros

