As for every keen event, keen object gets automatically attached with structure of keen object.
var keen_event = {
"keen": {
"created_at": "2012-12-14T20:24:01.123000+00:00",
"timestamp": "2012-12-14T20:24:01.123000+00:00",
"id": "asd9fadifjaqw9asdfasdf939"
},
other properties...
}
But I want to add other custom properties in keen object as;
{
"keen": {
"created_at": "2012-12-14T20:24:01.123000+00:00",
"timestamp": "2012-12-14T20:24:01.123000+00:00",
"id": "asd9fadifjaqw9asdfasdf939",
"event_type" : "some_values",
...
}
}
I tried adding other properties on keen and than encode the keen_event as:
var encodedData = base64.encode(JSON.stringify(keen_event));
The encoded data is then passed on keen api to create an event but I am getting error as : "Invalid property for keen namespace. You used: \'event_type\'".
Is there a solution for that? Is it possible to add custom key value properties other than standard properties on " keen" object while creating an keen event? Thanks in advance.
No, this isn't allowed in the Keen API. The keen
namespace is reserved and only a small handful of properties (such as keen.timestamp
or keen.addons
) may be specified in that namespace when an event is written. The namespace is reserved to allow Keen to add new special-purpose properties in the future and not worry about collisions with user-defined properties. (See also: https://keen.io/docs/api/#the-keen-object.)
Perhaps it's worth stepping back and asking: why do you want to add custom properties to the keen
namespace? What would it allow you to do that you couldn't do with, say, my.keen.x
or keen_custom.x
?
FYI: I'm a platform engineer at Keen :)