Commit 29febee8 authored by sajolida's avatar sajolida
Browse files

Allow doing metrics on downloads

This commit integrates hitting a (dummy) URL each time an ISO image is
verified by the verification extension. Doing web analytics on this URL
will give us metrics on the direct downloads of Tails.

I'm also tracking the scenario and the version of Tails.
parent a6942f92
......@@ -11,12 +11,15 @@ document.addEventListener("DOMContentLoaded", function() {
}
else if (event.data.action === "verification-failed") {
showVerificationResult("failed");
hitCounter("failed");
}
else if (event.data.action === "verification-failed-again") {
showVerificationResult("failed-again");
hitCounter("failed-again");
}
else if (event.data.action === "verification-success") {
showVerificationResult("successful");
hitCounter("successful");
}
else if (event.data.action === "progress") {
showVerificationProgress(event.data.percentage);
......@@ -170,6 +173,15 @@ document.addEventListener("DOMContentLoaded", function() {
}
}
function hitCounter(status) {
var counter_url, url, scenario, version;
counter_url = "https://tails.boum.org/install/download/counter";
url = window.location.href.split("/");
scenario = url[url.lastIndexOf("install") + 1];
version = document.getElementById("tails-version").textContent.replace("\n", "");
fetch(counter_url + "?scenario=" + scenario + "&version=" + version + "&status=" + status);
}
function resetVerificationResult(result) {
hide(document.getElementById("verifying-download"));
hide(document.getElementById("verification-successful"));
......
<div id="activate-tails-verification"></div> <!-- Needed to activate the verification extension -->
<div id="extension-version">1.0</div> <!-- Minimum version of the extension -->
<div id="tails-version">[[!inline pages="inc/stable_amd64_version" raw="yes" sort="age"]]</div>
<h1 class="debian windows linux mac-usb mac-dvd dvd vm upgrade-tails">Download Tails [[!inline pages="inc/stable_amd64_version" raw="yes" sort="age"]]</h1>
......
......@@ -24,6 +24,7 @@ h1 {
#skip-download-direct,
#skip-download-bittorrent,
#extension-version,
#tails-version,
.use-mirror-pool-on-retry {
display: none;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment