How to start measuring events

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.


Using JavaScript

The most practical solutions, client side, is to use JavaScript. First, you insert the following line:

<script src="https://app.indiemetrics.net/hello.js"></script>


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.


Alternatively, you can send a JavaScript Object as a parameter as well.

ogma("send", "event", [<object>]);


Using a hidden pixel

If the JavaScript method is not possible or desirable, Indiemetrics provides an image based alternative. Insert the following line into your html. Here as well, every parameter, except create and 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">