Skip to content

Commit 350ee31

Browse files
vojtajinaIgorMinar
authored andcommitted
Google Analytics - basic page tracking for docs
1 parent 2da0712 commit 350ee31

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

docs/src/templates/docs.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ function DocsController($location, $browser, $window) {
4747

4848
this.afterPartialLoaded = function() {
4949
SyntaxHighlighter.highlight();
50-
window.scrollTo(0,0);
50+
$window.scrollTo(0,0);
51+
$window._gaq.push(['_trackPageview', $location.hashPath.replace('!', '/')]);
5152
};
5253

5354
this.getFeedbackUrl = function() {

docs/src/templates/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
<link rel="stylesheet" href="docs-combined.css" type="text/css"/>
1010
<link rel="stylesheet" href="syntaxhighlighter/syntaxhighlighter-combined.css" type="text/css"/>
1111
<script>
12+
// GA asynchronous tracker
13+
var _gaq = _gaq || [];
14+
_gaq.push(['_setAccount', 'UA-8594346-3']);
15+
1216
/*!
1317
* $script.js v1.3
1418
* https://github.com/ded/script.js
@@ -84,5 +88,14 @@
8488
<br class="clearFloat" />
8589
<div id="twoColFooter">© 2010-2011 angular</div>
8690
</div>
91+
92+
<script type="text/javascript">
93+
// lazy load GA asynchronous tracker
94+
(function() {
95+
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
96+
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
97+
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
98+
})();
99+
</script>
87100
</body>
88101
</html>

0 commit comments

Comments
 (0)