Now a days, a lot of websites are using CDN for offloading their website. The idea is that the CDN does the most requests and only dynamic content will requested from your server. (Content delivery network - Wikipedia)
And often they generate reports with numbers how much is cached and how much hits are sent to the origin server. But would it not be nice to check those numbers? With Piwik it is possible.
In the following small tutorial I explain how I measure my cache misses.
[li] My website is at [domain].com or www.[domain].com
[/li][li] My CDN is at cdn.[domain].com which is an alias for [domain].com or www.[domain].com
[/li][li] I use NGINX which does log the vhost that is requested in the logline
[/li][li] In Piwik create a Goal named Cache Misses with the following settings
[li] Goal is triggered -> Visit a given URL (page or group of pages)
[/li][li] where the URL -> contains -> http://cdn.[domain].com
[/li][li] Allow multiple conversions per visit -> Allow Goal to be converted more than once per visit
When this is setup, and you start importing Logfiles with the vHost in the logline, Piwik will see the different host names, and count all starting with cdn.[domain].com. And when all the loglines are parsed, you will get the amount of cache misses in absolute number, and percentage. This is the default behavior of Goals in Piwik.
This way I check if my caching is performing well. If the cache misses rises, there is something wrong with my caching headers.