Monitor event occurrence and save it to tinyDB

Use the event name as a tag, and the count as a value, default 0.
Do not use any global variables for this.