add analytics tracking event for sdk/ndk downloads

Change-Id: Icb04694ef9498ae684350ad4a971fb23d0301605
This commit is contained in:
Scott Main 2012-10-03 16:34:52 -07:00
parent a4888dc865
commit 46c5804c47
1 changed files with 18 additions and 9 deletions

View File

@ -87,7 +87,8 @@
<tr>
<td>Windows</td>
<td>
<a href="http://dl.google.com/android/ndk/<?cs var:ndk.win_download ?>"><?cs var:ndk.win_download ?></a>
<a onClick="_gaq.push(['_trackEvent', 'Tools', 'Download NDK', 'Link <' + <?cs var:ndk.win_download ?> + '>']);"
href="http://dl.google.com/android/ndk/<?cs var:ndk.win_download ?>"><?cs var:ndk.win_download ?></a>
</td>
<td><?cs var:ndk.win_bytes ?> bytes</td>
<td><?cs var:ndk.win_checksum ?></td>
@ -95,7 +96,8 @@
<tr class="alt-color">
<td>Mac OS X (intel)</td>
<td>
<a href="http://dl.google.com/android/ndk/<?cs var:ndk.mac_download ?>"><?cs var:ndk.mac_download ?></a>
<a onClick="_gaq.push(['_trackEvent', 'Tools', 'Download NDK', 'Link <' + <?cs var:ndk.mac_download ?> + '>']);"
href="http://dl.google.com/android/ndk/<?cs var:ndk.mac_download ?>"><?cs var:ndk.mac_download ?></a>
</td>
<td><?cs var:ndk.mac_bytes ?> bytes</td>
<td><?cs var:ndk.mac_checksum ?></td>
@ -103,7 +105,8 @@
<tr>
<td>Linux 32/64-bit (x86)</td>
<td>
<a href="http://dl.google.com/android/ndk/<?cs var:ndk.linux_download ?>"><?cs var:ndk.linux_download ?></a>
<a onClick="_gaq.push(['_trackEvent', 'Tools', 'Download NDK', 'Link <' + <?cs var:ndk.linux_download ?> + '>']);"
href="http://dl.google.com/android/ndk/<?cs var:ndk.linux_download ?>"><?cs var:ndk.linux_download ?></a>
</td>
<td><?cs var:ndk.linux_bytes ?> bytes</td>
<td><?cs var:ndk.linux_checksum ?></td>
@ -147,7 +150,7 @@
<tr>
<td rowspan="2">Windows</td>
<td>
<a onclick="onDownload(this)" href="http://dl.google.com/android/<?cs var:sdk.win_download
<a onclick="onDownload(this,false)" href="http://dl.google.com/android/<?cs var:sdk.win_download
?>"><?cs var:sdk.win_download ?></a>
</td>
<td><?cs var:sdk.win_bytes ?> bytes</td>
@ -156,7 +159,7 @@
<tr>
<!-- blank TD from Windows rowspan -->
<td>
<a onclick="onDownload(this)" id="win-sdk" href="http://dl.google.com/android/<?cs
<a onclick="onDownload(this,false)" id="win-sdk" href="http://dl.google.com/android/<?cs
var:sdk.win_installer
?>"><?cs var:sdk.win_installer ?></a> (Recommended)
</td>
@ -166,7 +169,7 @@ var:sdk.win_installer
<tr class="alt-color">
<td>Mac OS X (intel)</td>
<td>
<a onclick="onDownload(this)" id="mac-sdk" href="http://dl.google.com/android/<?cs
<a onclick="onDownload(this,false)" id="mac-sdk" href="http://dl.google.com/android/<?cs
var:sdk.mac_download
?>"><?cs var:sdk.mac_download ?></a>
</td>
@ -176,7 +179,7 @@ var:sdk.mac_download
<tr>
<td>Linux (i386)</td>
<td>
<a onclick="onDownload(this)" id="linux-sdk" href="http://dl.google.com/android/<?cs
<a onclick="onDownload(this,false)" id="linux-sdk" href="http://dl.google.com/android/<?cs
var:sdk.linux_download
?>"><?cs var:sdk.linux_download ?></a>
</td>
@ -187,12 +190,18 @@ var:sdk.linux_download
<script>
function onDownload(link) {
function onDownload(link,fromButton) {
$("#filename").text($(link).html());
$("#next-steps").fadeIn('slow');
$("#intro").fadeOut('slow');
$('.pax').slideUp();
$('.reqs').slideUp();
// Deliver Analytics event
if (fromButton) {
_gaq.push(['_trackEvent', 'Tools', 'Download SDK', 'Button <' + text($(link).html()) + '>']);
} else {
_gaq.push(['_trackEvent', 'Tools', 'Download SDK', 'Link <' + text($(link).html()) + '>']);
}
}
@ -213,7 +222,7 @@ var:sdk.linux_download
$('#not-supported').hide();
$('#download-button').show();
$('#download-button').text("Download the SDK for " + os);
$('#download-button').click(function() {onDownload($link.get());}).attr('href', $link.attr('href'));
$('#download-button').click(function() {onDownload($link.get());}).attr('href', $link.attr('href'),true);
} else {
$('.pax').show();
}