I'm not 100% positive which version of web2py my original views/
layout.html came from, but I thought I'd share an issue and what I
have found to fix it.

My site is entirely ssl.

The default code for google analytics (I only modified the account )
seems to be old according to the GA page.  Occasionally my customer
was getting a certificate error.  The cert error was of the 'cn does
not match url' variety and the certificate details were the standard
*.google.com certificate used for a lot of their services.  There are
only two references to google in my entire site.  Google analytics and
youtube.

While I have not entirely ruled out the embedded youtube videos
(embedded with ssl links so browser errors dont pop up), it seems that
changing the GA code to the latest "version" has resolved the
problem.  I suggest modifying the layout.html in trunk (if it hasn't
been already).  Note the new javascript does automatic protocol
detection for ssl.


OLD Code:

{{if response.google_analytics_id:}}<script>/*
http://mathiasbynens.be/notes/async-analytics-snippet */ var
_gaq=[['_setAccount','{{=response.google_analytics_id}}'],
['_trackPageview']];(function(d,t){var
g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.src='//
www.google-analytics.com/ga.js';s.parentNode.insertBefore(g,s)}(document,'script'))
</script>{{pass}}

New code from Google Analytics page:

        <script type="text/javascript">

          var _gaq = _gaq || [];
          _gaq.push(['_setAccount', 'UA-XXXXXXX-XX']);
          _gaq.push(['_trackPageview']);

          (function() {
            var ga = document.createElement('script'); ga.type = 'text/
javascript'; ga.async = true;
            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);
          })();

        </script>



I will reply to this post if I find out that this didn't fix the
problem... although it seems as though it has.

Reply via email to