Skip to content

Commit cb05ff0

Browse files
committed
update ga script
1 parent 746cc0a commit cb05ff0

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

server/index_handler.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,13 @@ var index = `<!DOCTYPE html><html>
1717
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
1818
1919
{{if .Configuration.GoogleAnalytics}}
20-
<script type="text/javascript">
21-
var _gaq = _gaq || [];
22-
_gaq.push(['_setAccount', '{{.Configuration.GoogleAnalytics}}']);
23-
_gaq.push(['_trackPageview']);
20+
<script async src="https://www.googletagmanager.com/gtag/js?id={{.Configuration.GoogleAnalytics}}"></script>
21+
<script>
22+
window.dataLayer = window.dataLayer || [];
23+
function gtag(){dataLayer.push(arguments);}
24+
gtag('js', new Date());
2425
25-
(function() {
26-
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
27-
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
28-
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
29-
})();
26+
gtag('config', '{{.Configuration.GoogleAnalytics}}');
3027
</script>
3128
{{end}}
3229
</head>

0 commit comments

Comments
 (0)