Measing events can be done in two ways. Both ways can be arranged that the second is a fallback for the other. This is in parrallel with measuring pageviews. The second method can be used in combination with curl to track server side events as well, for example cron jobs.
Now you can use
ogma(...) as a global function. Now you set your siteId using:
ogma("create", "<your site id>");
And register the event using:
ogma("send", "event", [<category>], [<action>], [<label>], [<value>]);
As you can see, every parameter, except for the first two, is optional in order to give you as much flexibility that your need.
ogma("send", "event", [<object>]);
Insert the following line into your html. Here as well, every parameter, except
type is optional.
<img src="https://app.indiemetrics.net/event/add?create=<SITE ID>&type=event[&category=<CATEGORY>][&action=<ACTION>][&label=<LABEL>][&value=<VALUE>]" alt="Indiemetrics">