Skip to content

Commit 2bdb150

Browse files
committedMar 19, 2018
track download events #4
1 parent 9ae0641 commit 2bdb150

File tree

3 files changed

+34
-3
lines changed

3 files changed

+34
-3
lines changed
 

‎_includes/analytics.html

+13
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,18 @@
77

88
ga('create', 'UA-47201501-1', 'auto');
99
ga('send', 'pageview');
10+
11+
/**
12+
* Function that tracks a click on an outbound link in Analytics.
13+
* This function takes a valid URL string as an argument, and uses that URL string
14+
* as the event label. Setting the transport method to 'beacon' lets the hit be sent
15+
* using 'navigator.sendBeacon' in browser that support it.
16+
*/
17+
var trackOutboundLink = function(url) {
18+
ga('send', 'event', 'outbound', 'click', url, {
19+
'transport': 'beacon',
20+
'hitCallback': function(){document.location = url;}
21+
});
22+
}
1023
</script>
1124
<!-- End Google Analytics -->

‎_includes/header.html

+15
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,22 @@
8585
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
8686
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
8787
})();
88+
8889
</script>
90+
<script type="text/javascript">
91+
/**
92+
* Function that tracks a click on an outbound link in Analytics.
93+
* This function takes a valid URL string as an argument, and uses that URL string
94+
* as the event label. Setting the transport method to 'beacon' lets the hit be sent
95+
* using 'navigator.sendBeacon' in browser that support it.
96+
*/
97+
var trackOutboundLink = function(url) {
98+
ga('send', 'event', 'outbound', 'click', url, {
99+
'transport': 'beacon',
100+
'hitCallback': function(){document.location = url;}
101+
});
102+
}
103+
</script>
89104

90105
<style id="simpler-css-style" type="text/css">
91106
.site-content .entry-header,

‎index.html

+6-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@
99
<h2>Download</h2>
1010
<p>The latest version of BEAST 2 is version 2.4.8:</p>
1111
<ul>
12-
<li><a id="windowsDownload" href="https://github.com/CompEvol/beast2/releases/download/v2.4.8/BEAST.v2.4.8.Windows.zip">Download for Windows</a></li>
13-
<li><a id="macDownload" href="https://github.com/CompEvol/beast2/releases/download/v2.4.8/BEAST.v2.4.8.Mac.dmg">Download for Mac OS X</a></li>
14-
<li><a id="linuxDownload" href="https://github.com/CompEvol/beast2/releases/download/v2.4.8/BEAST.v2.4.8.Linux.tgz">Download for Linux</a></li>
12+
<li><a id="windowsDownload" href="https://github.com/CompEvol/beast2/releases/download/v2.4.8/BEAST.v2.4.8.Windows.zip"
13+
onclick="trackOutboundLink('https://github.com/CompEvol/beast2/releases/download/v2.4.8/BEAST.v2.4.8.Windows.zip'); return false;">Download for Windows</a></li>
14+
<li><a id="macDownload" href="https://github.com/CompEvol/beast2/releases/download/v2.4.8/BEAST.v2.4.8.Mac.dmg"
15+
onclick="trackOutboundLink('https://github.com/CompEvol/beast2/releases/download/v2.4.8/BEAST.v2.4.8.Mac.dmg'); return false;">Download for Mac OS X</a></li>
16+
<li><a id="linuxDownload" href="https://github.com/CompEvol/beast2/releases/download/v2.4.8/BEAST.v2.4.8.Linux.tgz"
17+
onclick="trackOutboundLink('https://github.com/CompEvol/beast2/releases/download/v2.4.8/BEAST.v2.4.8.Linux.tgz'); return false;">Download for Linux</a></li>
1518
</ul>
1619
<p class="p1">The BEAST 2 source code is available from the <a href="http://www.github.com/CompEvol/beast2">GitHub repository</a>, which produces the latest cutting edge jar file here: <a href="http://hudson.cs.auckland.ac.nz/job/BEAST2/lastSuccessfulBuild/artifact/build/dist/beast.jar">beast.jar</a></p>
1720
<h3>Previous releases and version history</h3>

0 commit comments

Comments
 (0)
Please sign in to comment.