1. You need a form with the counter field(s)
2. Create the document, or your agent could do it if none exists.
3. Use a view for getting the document.
4. You could have more views with more counters etc.
If you are going through the web, use WebQueryOpen on the form that is the front page.
Then run the agent from the WebQueryOen that adds 1 to the counter.