I posted it in the Content Exchange: Save DailyStats to a file . I had to remove a lot of other parts of the script that were only relevant to our workflow, please test before relying on it...
Acy also had posted a script to send the stats via email: E-mailing Statistics in a Scheduled Action