The easiest way to create stats is directly in your code. You just add a line
of code with the new stat name. When StatHat receives the first data point, it will
create the stat for you. We have libraries for a lot of languages to make it easy.
StatHat stats come in two flavors: counter and value. Counter stats are summed up
over time. Value stats are averaged over time.
An example of a counter stat would be
user created. Every time a user is created, you would send StatHat a count of 1.
Then you could see how many users were created over the past hour, day, week, month,
year.
An example value stat is sign in - age of user. Any time someone signs in, you
would send StatHat their age. Looking at this stat would show you the average age
of your active users and how it varies with time.
The code is a bit different depending on if the stat is a counter or value, so select
the stat type for your stat first:
[StatHat postEZStat:@"sign in - age of user" withValue:27.0 forUser:@"YOUR_EZKEY" delegate:self];
Using the EZ API with HTML is discouraged as it would expose your key. For HTML, we recommend using the Classic API. You need to create each stat individually on this page.
Download stathat.php and put it in your import path.
stathat_ez_value('YOUR_EZKEY', 'sign in - age of user', 27.0)
Using the EZ API with JavaScript in the browser is discouraged as it would expose your key. For JavaScript, we recommend using the Classic API. You need to create each stat individually on this page.
stathat:ez_value("YOUR_EZKEY", "sign in - age of user", 27.0).
Change the stat name to whatever you want.
StatHat will create a new stat for you when it receives the first data point. You'll get an email when that happens.
The Help area of StatHat contains documents describing the API in detail, as
well as more examples, FAQs, and details for each language StatHat supports.