Task #353
closed
Feature #352: Implement website mirrors
Php script to track downloads
Added by Jean-Michel Philippe over 13 years ago.
Updated over 12 years ago.
Description
If we copy our CD images onto mirror sites, we have to write a Php script on these mirrors to collect information about download figures per file. Currently we're getting these figures from the integrated web stats engines of doudoulinux.org. Obviously we won't be able to arrange mirrors to be counted by these tools. So we need a custom tool that will gather all downloads from all our sites in the end.
We can try to use Piwik as the stat engine. It can already be used to summarize stats from all our (future) website mirrors since Piwik API calls are included in DDL web pages header. So why not downloads?
- % Done changed from 0 to 10
Piwik can indeed capture statistics of several web sites, domains, and subdomain (http://piwik.org/faq/new-to-piwik/#faq_104).
It’s the same principle of the Google Analytics : each site has specific report, each site has separate statistics (http://piwik.org/docs/manage-websites/).
We can add Piwik on the master server and track the master domain and the secondary domain hosted on one or more servers (http://piwik.org/faq/general/#faq_67).
For detect a domain, it’s necessary to configure the cookies (http://piwik.org/docs/javascript-tracking/#toc-cookies-configuration-for-domains-and-sub-domains) and the title of the tracking on the webpages.
The tracking code (in javascript) can be added in a redirection page for the image.
Sample:
< website directory >
[ master download page ]
.. URL to download the french ISO on the master server .. (/redirection/master-iso-ddl-fr.php)
.. URL to download the french ISO on the mirror server .. (/redirection/mirror-iso-ddl-fr.php)
[/ master download page ]
< /website directory >
< redirection directory >
[ master-iso-ddl-fr.php ]
.. code for the webpage including redirection (meta tag and javascript redirection) and Piwik code ..
[ /masteriso-ddl-fr.php ]
[ mirror-iso-ddl-fr.php ]
.. code for the webpage including redirection (meta tag and javascript redirection) and Piwik code ..
[ /mirror-iso-ddl-fr.php ]
< /redirection directory >
All the redirection page can be on one server (master or mirror), because Piwik can track on or more website, domain or subdomain.
- Status changed from New to In Progress
- % Done changed from 10 to 20
Here is a fully sample :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- InstanceBeginEditable name="doctitle" -->
<title>doudoulinux.be Redirection</title>
<link href="http://doudoulinux.org/favicon.ico" rel="shortcut icon">
<link href="/files/css/screen.reset-1.0.css" rel="stylesheet" type="text/css" media="screen">
<link href="/files/css/screen.normal-1.0.css" rel="stylesheet" type="text/css" media="screen">
<!--[if lt IE 8]>
<link href="/files/css/ie.css" rel="stylesheet" type="text/css" media="screen">
<![endif]-->
<meta http-equiv="refresh" content="40;url=http://doudoulinux.be/fichiers/download/images/doudoulinux-version-1-gondwana.iso" />
</head>
<body>
<div id="global">
<div id="center">
<div id="content">
<p>redirection en cours, veuillez patienter</p>
<p><a href="http http://doudoulinux.be/fichiers/download/images/doudoulinux-version-1-gondwana.iso "> http://doudoulinux.be/fichiers/download/images/doudoulinux-version-1-gondwana.iso</a></p>
<p><a href="http://doudoulinux.org" title="Doudoulinux.org (homepage)" tabindex="1" accesskey="1">Back to homepage</a></p>
<script type="text/javascript">
document.location.replace("http://doudoulinux.be/fichiers/download/images/doudoulinux-version-1-gondwana.iso");
</script>
</div> <!-- fin de content -->
</div> <!-- fin de center -->
</div> <!-- fin de global -->
<!-- PIWIK ANALYTICS -->
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://{$PIWIK_URL}/" : "http://{$PIWIK_URL}/");
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
</script><script type="text/javascript">
try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", {$IDSITE});
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
</script>
<!-- END PIWIK ANALYTICS -->
</body>
</html>
- Status changed from In Progress to Need info
- Assignee changed from Xavier Brusselaers to Jean-Michel Philippe
- Assignee changed from Jean-Michel Philippe to Xavier Brusselaers
Sorry, I'm not so computer-dependent! So I'm discovering the full story ;).
I must say I'm a bit disappointed by the latest messages. I first understood redirection would happen using a Php script. This Php script just has to call some Piwik stuff to gather stats figures, which is a nice idea, and give users the file to be downloaded. Note that I don't know how precise can be our download figures with such practice, but it sounds good.
Then comes javascript… and I don't understand anymore! Note that javascript can be disabled (NoScript extension) or not available (command line download, with wget). How would stats be counted in this case?
- Due date set to 09/30/2011
- Status changed from Need info to Closed
- Assignee changed from Xavier Brusselaers to Jean-Michel Philippe
- Target version set to Gondwana update 1
- % Done changed from 20 to 100
- Estimated time set to 6:00 h
Also available in: Atom
PDF