Permalink
Browse files

Switch back to the optimized asynchronous Google Analytics snippet.

Don’t set .async = true, since it only makes a difference in Firefox 3.6. See http://mathiasbynens.be/notes/async-analytics-snippet#async for details.

This reverts commit d9cc711 and fixes #720.
  • Loading branch information...
mathiasbynens committed Aug 25, 2011
1 parent fccc482 commit 4caa411f01a5e18dcfce8aa940e806e272b0ff33
Showing with 26 additions and 12 deletions.
  1. +10 −3 demo/elements.html
  2. +10 −3 demo/tests.html
  3. +6 −6 index.html
View
@@ -473,14 +473,21 @@ <h1>&lt;meter&gt;</h1>
<script defer src="../js/script.js"></script>
<!-- end scripts-->
-
- <!-- mathiasbynens.be/notes/async-analytics-snippet Change UA-XXXXX-X to be your site's ID -->
+ <!-- Asynchronous Google Analytics snippet. Change UA-XXXXX-X to be your site's ID.
+ mathiasbynens.be/notes/async-analytics-snippet -->
<script>
var _gaq=[['_setAccount','UA-XXXXX-X'],['_trackPageview'],['_trackPageLoadTime']];
- (function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.async=1;
+ (function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
s.parentNode.insertBefore(g,s)}(document,'script'));
</script>
+ <!-- Prompt IE 6 users to install Chrome Frame. Remove this if you want to support IE 6.
+ chromium.org/developers/how-tos/chrome-frame-getting-started -->
+ <!--[if lt IE 7 ]>
+ <script defer src="//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.3/CFInstall.min.js"></script>
+ <script defer>window.attachEvent('onload',function(){CFInstall.check({mode:'overlay'})})</script>
+ <![endif]-->
+
</body>
</html>
View
@@ -280,14 +280,21 @@
<script defer src="../js/script.js"></script>
<!-- end scripts-->
-
- <!-- mathiasbynens.be/notes/async-analytics-snippet Change UA-XXXXX-X to be your site's ID -->
+ <!-- Asynchronous Google Analytics snippet. Change UA-XXXXX-X to be your site's ID.
+ mathiasbynens.be/notes/async-analytics-snippet -->
<script>
var _gaq=[['_setAccount','UA-XXXXX-X'],['_trackPageview'],['_trackPageLoadTime']];
- (function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.async=1;
+ (function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
s.parentNode.insertBefore(g,s)}(document,'script'));
</script>
+ <!-- Prompt IE 6 users to install Chrome Frame. Remove this if you want to support IE 6.
+ chromium.org/developers/how-tos/chrome-frame-getting-started -->
+ <!--[if lt IE 7 ]>
+ <script defer src="//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.3/CFInstall.min.js"></script>
+ <script defer>window.attachEvent('onload',function(){CFInstall.check({mode:'overlay'})})</script>
+ <![endif]-->
+
</body>
</html>
View
@@ -59,15 +59,15 @@
<!-- end scripts -->
- <!-- Change UA-XXXXX-X to be your site's ID -->
+ <!-- Asynchronous Google Analytics snippet. Change UA-XXXXX-X to be your site's ID.
+ mathiasbynens.be/notes/async-analytics-snippet -->
<script>
- window._gaq = [['_setAccount','UAXXXXXXXX1'],['_trackPageview'],['_trackPageLoadTime']];
- Modernizr.load({
- load: ('https:' == location.protocol ? '//ssl' : '//www') + '.google-analytics.com/ga.js'
- });
+ var _gaq=[['_setAccount','UA-XXXXX-X'],['_trackPageview'],['_trackPageLoadTime']];
+ (function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
+ g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
+ s.parentNode.insertBefore(g,s)}(document,'script'));
</script>
-
<!-- Prompt IE 6 users to install Chrome Frame. Remove this if you want to support IE 6.
chromium.org/developers/how-tos/chrome-frame-getting-started -->
<!--[if lt IE 7 ]>

0 comments on commit 4caa411

Please sign in to comment.