Please see the GitHub project page for PHP Analytics Event.
<?php
require_once "class.Analytics.php";
// Send latest command line client zip file.
header(…);
readfile(…);
// Record the download event in Analytics
$events = new Analytics("UAxxxxxxx", "example.com");
$events->trackEvent("resources", "download", "cli-latest");