Add google download statistics

This commit is contained in:
Victor Shcherb 2012-01-14 00:59:59 +01:00
parent d0c7c82a30
commit e0e9ab6d3a
2 changed files with 4 additions and 3 deletions

View file

@ -12,5 +12,5 @@ done
mkdir -p $LOCAL_SITE_DIR/resource;
cp $GIT_SITE_DIR/resource/* $LOCAL_SITE_DIR/resource/ -u;
mkdir -p $LOCAL_SITE_DIR/GoogleAnalytics;
cp $GIT_SITE_DIR/GoogleAnalytics/* $LOCAL_SITE_DIR/GoogleAnalytics/ -u;
cp $GIT_SITE_DIR/GoogleAnalytics/* $LOCAL_SITE_DIR/GoogleAnalytics/ -ru;

View file

@ -1,4 +1,6 @@
<?php
use GoogleAnalytics as UnitedPrototype\GoogleAnalytics;
function downloadFile($filename) {
if (!file_exists($filename)) {
header('HTTP/1.0 404 Not Found');
@ -79,8 +81,7 @@ function update_count_of_downloads($file) {
if(!isset($_SERVER['HTTP_RANGE']) ) {
// old version
// update_count_of_downloads($file) ;
use UnitedPrototype\GoogleAnalytics;
$tracker = new GoogleAnalytics\Tracker('UA-28342846-1', 'download.osmand.net');
$visitor = new GoogleAnalytics\Visitor();
$visitor->setIpAddress($_SERVER['REMOTE_ADDRESS']);