Skip to content

Commit 0dea7ca

Browse files
committed
bugfix: when the user cannot access google at all (and hangs), the google analytics tracking code should not block the whole page from displaying.
1 parent be8e33c commit 0dea7ca

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

utils/gen-html-index-cn.pl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,15 @@
2929
3030
var _gaq = _gaq || [];
3131
_gaq.push(['_setAccount', 'UA-24724965-1']);
32+
_gaq.push(['_setDomainName', 'openresty.org']);
3233
_gaq.push(['_trackPageview']);
3334
34-
(function() {
35+
var _gaf = (function() {
3536
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
3637
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
3738
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
38-
})();
39+
});
40+
setTimeout(_gaf, 0);
3941
4042
</script>
4143
</head>

utils/gen-html-index-en.pl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,15 @@
3030
3131
var _gaq = _gaq || [];
3232
_gaq.push(['_setAccount', 'UA-24724965-1']);
33+
_gaq.push(['_setDomainName', 'openresty.org']);
3334
_gaq.push(['_trackPageview']);
3435
35-
(function() {
36+
var _gaf = (function() {
3637
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
3738
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
3839
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
39-
})();
40+
});
41+
setTimeout(_gaf, 0);
4042
4143
</script>
4244
</head>

0 commit comments

Comments
 (0)