cmd/present: include Google Analytics tracking code for talks.golang.org

This was formerly inserted by some deployment scripts. Putting it in
the code here simplifies deployment at little cost to other users.

Change-Id: Ic092bb560c4c90e0e5bc6f9f33426b35214d613d
Reviewed-on: https://go-review.googlesource.com/14741
Reviewed-by: Andrew Gerrand <adg@golang.org>
This commit is contained in:
Andrew Gerrand 2015-09-18 14:26:40 +10:00
parent 51ebb3f1be
commit ac6d9c1d84
3 changed files with 86 additions and 4 deletions

View File

@ -7,6 +7,23 @@
<title>{{.Title}}</title>
<link type="text/css" rel="stylesheet" href="/static/article.css">
<meta charset='utf-8'>
<script>
// Initialize Google Analytics tracking code on production site only.
if (window["location"] && window["location"]["hostname"] == "talks.golang.org") {
var _gaq = _gaq || [];
_gaq.push(["_setAccount", "UA-11222381-6"]);
_gaq.push(["b._setAccount", "UA-49880327-6"]);
window.trackPageview = function() {
_gaq.push(["_trackPageview", location.pathname+location.hash]);
_gaq.push(["b._trackPageview", location.pathname+location.hash]);
};
window.trackPageview();
window.trackEvent = function(category, action, opt_label, opt_value, opt_noninteraction) {
_gaq.push(["_trackEvent", category, action, opt_label, opt_value, opt_noninteraction]);
_gaq.push(["b._trackEvent", category, action, opt_label, opt_value, opt_noninteraction]);
};
}
</script>
</head>
<body>
@ -40,6 +57,16 @@
</div>
</div>
<script src='/play.js'></script>
<script>
(function() {
// Load Google Analytics tracking code on production site only.
if (window["location"] && window["location"]["hostname"] == "talks.golang.org") {
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>
</body>
</html>
{{end}}

View File

@ -1,10 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Talks - The Go Programming Language</title>
<link type="text/css" rel="stylesheet" href="/static/dir.css">
<script src="/static/dir.js"></script>
<script>
// Initialize Google Analytics tracking code on production site only.
if (window["location"] && window["location"]["hostname"] == "talks.golang.org") {
var _gaq = _gaq || [];
_gaq.push(["_setAccount", "UA-11222381-6"]);
_gaq.push(["b._setAccount", "UA-49880327-6"]);
window.trackPageview = function() {
_gaq.push(["_trackPageview", location.pathname+location.hash]);
_gaq.push(["b._trackPageview", location.pathname+location.hash]);
};
window.trackPageview();
window.trackEvent = function(category, action, opt_label, opt_value, opt_noninteraction) {
_gaq.push(["_trackEvent", category, action, opt_label, opt_value, opt_noninteraction]);
_gaq.push(["b._trackEvent", category, action, opt_label, opt_value, opt_noninteraction]);
};
}
</script>
</head>
<body>
@ -77,5 +94,15 @@ and code is licensed under a <a href="http://golang.org/LICENSE">BSD license</a>
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a>
</div>
<script>
(function() {
// Load Google Analytics tracking code on production site only.
if (window["location"] && window["location"]["hostname"] == "talks.golang.org") {
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>
</body>
</html>

View File

@ -7,6 +7,23 @@
<title>{{.Title}}</title>
<meta charset='utf-8'>
<script src='/static/slides.js'></script>
<script>
// Initialize Google Analytics tracking code on production site only.
if (window["location"] && window["location"]["hostname"] == "talks.golang.org") {
var _gaq = _gaq || [];
_gaq.push(["_setAccount", "UA-11222381-6"]);
_gaq.push(["b._setAccount", "UA-49880327-6"]);
window.trackPageview = function() {
_gaq.push(["_trackPageview", location.pathname+location.hash]);
_gaq.push(["b._trackPageview", location.pathname+location.hash]);
};
window.trackPageview();
window.trackEvent = function(category, action, opt_label, opt_value, opt_noninteraction) {
_gaq.push(["_trackEvent", category, action, opt_label, opt_value, opt_noninteraction]);
_gaq.push(["b._trackEvent", category, action, opt_label, opt_value, opt_noninteraction]);
};
}
</script>
</head>
<body style='display: none'>
@ -54,10 +71,21 @@
(Press 'H' or navigate to hide this message.)
</div>
{{if .PlayEnabled}}
<script src='/play.js'></script>
{{end}}
<script>
(function() {
// Load Google Analytics tracking code on production site only.
if (window["location"] && window["location"]["hostname"] == "talks.golang.org") {
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>
</body>
{{if .PlayEnabled}}
<script src='/play.js'></script>
{{end}}
</html>
{{end}}