How to setup PIWIK to track visitors' downloads
Overview
Posted on 28 March 2015
Author: SM
Category: Guides, Security
PIWIK is an amazing Open-Source Web Analytics platform which is a good alternative to Google Analytics as it provides full control of your data and more details such as full IP addresses.
Hosting Options
You have 3 hosting options:
- Use their cloud service. (More info here)
- Host it yourself online: at the back of your web server or on a different/dedicated server. (More info here)
- Host it offline, and manually import your apache logs. (More info here)
Advantages of Online Hosting
- You can use PHP/JavaScript trackers within your web pages which provides more information on your visitors like screen resolution, plugins, etc.
- Allows tracking of specific image downloads as described in this article.
Reporting
Currently, you cannot easily produce a report on who has downloaded a file. Under Actions -> Downloads, you get an overall total number of downloads for each file but no other details.
Below is a workaround to track download details:
- Note: This only works for logs produced after setup.
- Go to Goals -> Add new Goals.
- Name your goal.
- If the file is a binary, select "download a file." Set the filter to "contains" and type the filename (e.g., enter "package" for files like package1.rar).
- Allow the Goal to be converted more than once per visit.
- Add the goal.
If tracking a specific HTML page or shell script, select "visit a given URL" instead of "download a file." No need to use full URL or regex.
Generating Reports
To generate a report:
- Get your goal ID by adding a goal, then click on the "manage goal" link to note the IDs.
- Go back to your PIWIK dashboard.
- Click on the "ALL VISITS" filter and then "Add a Segment."
- From the left, select "Visit" and drag & drop "Visit Converted a specific Goal ID" to the right, inputting your Goal ID.
- Name that Segment.
- If removing bot hits, open "Custom Variables" and drag & drop "custom variable 1" to the right, specifying "is" "NOT-BOT."
- Save & apply.
By creating different goals and segments as described, you can generate detailed reports on downloads from your website. Any new logs imported after this setup will be evaluated and reported on.
Conclusion
A simpler way to generate reports and retrospective hits would be beneficial and might be considered for future releases.