analytics service - create function that runs the stats and store them in a JSON flat file