added analytics tracking and saving metrics of delivery stats.