Google Analytics - 'analytics is not defined' error

1,287 views
Skip to first unread message

st...@hurlingstats.com

unread,
Jul 24, 2013, 10:12:34 AM7/24/13
to web...@googlegroups.com
Wondering if anyone has seen this.

I've set my tracking id in menu.py

response.google_analytics_id = 'UA-XXXXXXXX-X'

When I load my site, I get js errors:


ReferenceError: analytics is not defined
Line 2682

This is what I have in layout.html

  {{if response.google_analytics_id:}}
  <script src="{{=URL('static','js/analytics.js')}}"></script>
  <script type="text/javascript">
  analytics.initialize({
    'Google Analytics':{trackingId:'{{=response.google_analytics_id}}'} 
  });</script>
  {{pass}}

Using web2py v2.5.1-stable+timestamp.2013.06.06.10.23.23

Paolo Valleri

unread,
Jul 24, 2013, 4:20:00 PM7/24/13
to web...@googlegroups.com
You found an issue, in the welcome app the analytics library is shiped as minified, given that the correct file name is analytics.min.js instead of analytics.js
btw, it is a bit out of date.

Paolo
Reply all
Reply to author
Forward
0 new messages