Skip to content

Commit

Permalink
GA tracking for download page integrated.
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalohlava committed Nov 4, 2013
1 parent 45472cc commit 7e8aff7
Showing 1 changed file with 44 additions and 13 deletions.
57 changes: 44 additions & 13 deletions packaging/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,36 @@
//resource = "./".concat(res[res.length-1]).concat("/").concat(
resource = id.concat("/").concat(id).concat(".html");
r = new XMLHttpRequest();
r.open("HEAD", resource, true);
r.send(null);
r.onreadystatechange = function () {
if(r.readyState === 4) {
var d = document.getElementById(id);
if(r.status === 200) d.style.display = "inline";
try {
r.open("HEAD", resource, true);
r.send(null);
r.onreadystatechange = function () {
if(r.readyState === 4) {
var d = document.getElementById(id);
if(r.status === 200) d.style.display = "inline";
}
}
}
} catch(err) { }
}
<!-- GA setup -->
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','http://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-29263631-3', {'cookieDomain': 'none'});
ga('send', 'pageview', {
'title': 'H2O Downloads for SUBST_PROJECT_VERSION'
});
<!-- GA sending events -->
function trackLink(id, category, action) {
var l = document.getElementById(id);
l.onclick = function() {
var that=l;
ga('send', 'event', category, action, 'SUBST_PROJECT_VERSION');
setTimeout(function() { location.href = that.href; }, 300);
return false;
};
}
</script>
</head>
Expand Down Expand Up @@ -47,7 +69,7 @@ <h2 align="center">
<td align="center">Any</td>
<td align="center">Zip file</td>
<td>For all users on any platform.</td>
<td align="center"><a href="h2o-SUBST_PROJECT_VERSION.zip">h2o-SUBST_PROJECT_VERSION.zip</a></td>
<td align="center"><a href="h2o-SUBST_PROJECT_VERSION.zip" id="dzip">h2o-SUBST_PROJECT_VERSION.zip</a></td>
</tr>

<!--
Expand Down Expand Up @@ -85,21 +107,22 @@ <h2 align="center">
<tr>
<td align="center">Full documentation</td>
<td>All documentation available for this version.</td>
<td align="center"><a href="docs-website/index.html">H2O SUBST_PROJECT_VERSION Documentation</a></td>
<td align="center"><a href="docs-website/index.html" id="ddocall">H2O SUBST_PROJECT_VERSION Documentation</a></td>
</tr>
<tr>
<td align="center">R documentation</td>
<td>R user documentation available for this version.</td>
<td align="center"><a href="docs-website/bits/h2oRjoin.pdf">H2O SUBST_PROJECT_VERSION R Package PDF</a></td>
<td align="center"><a href="docs-website/bits/h2oRjoin.pdf" id="ddocr">H2O SUBST_PROJECT_VERSION R Package PDF</a></td>
</tr>
<tr>
<td align="center">Javadoc</td>
<td>Java developer documentation available for this version.</td>
<td align="center"><a href="javadoc/index.html">H2O SUBST_PROJECT_VERSION Javadoc</a></td>
<td align="center"><a href="javadoc/index.html" id="ddocjavadoc">H2O SUBST_PROJECT_VERSION Javadoc</a></td>
</tr>
<tr>
<td align="center">REST API documentation</td>
<td>REST (and JSON) API developer documentation available for this version.</td>
<!-- DO NOT FORGET TO PUT HERE GA tracker ! -->
<td align="center">(Coming soon)</td>
</tr>
</table>
Expand Down Expand Up @@ -146,11 +169,19 @@ <h2 align="center">
</tr>
</table>
</div>
<script type="text/javascript">
<!-- DOM 0 style without jquery -->
window.onload = function() {
trackLink("dzip", "Download", "ZIP");
trackLink("ddocall", "Documentation", "All");
trackLink("ddocr", "Documentation", "R");
trackLink("ddocjavadoc", "Documentation", "Javadoc");

<script>
load("bench");
load("test");
}
</script>

</body>
</html>


0 comments on commit 7e8aff7

Please sign in to comment.