Closed dAnjou closed 9 years ago
To listen to the events you just have to do this:
CommonWeb.Callback = function(collection, properties, callback) {
// do something with the event here!
};
That function will be called in each event.
So in the demo you can just replace CommonWeb.Callback = CommonWeb.Keen.Callback; in index.html, with the code above and do whatever you want with the events.
Hey @dAnjou -
Yeah, the README definitely needs some work. I'll get that on my todo list.
The description you posted is pretty accurate for what CommonWeb does, but I guess it might not be super clear how we actually accomplish that.
As @tiagoaf5 said, whenever an event gets called, we pass the event and all of the related data to CommonWeb.Callback
. You can do whatever you want with that event, but most likely you'll want to send it off to some sort of analytics service.
Our hope is that over time we will be able to build up a variety of plugins for automatically sending data to different services, but for now the only one we have built in is for keen.io.
You can initialize the Keen plugin with code like this:
CommonWeb.Keen.Client = new Keen({
projectId: "your_project_id",
writeKey: "your_write_key"
});
CommonWeb.addGlobalProperties(CommonWeb.Keen.globalProperties);
CommonWeb.Callback = CommonWeb.Keen.Callback;
@dAnjou I'm going to close this for now, but if you have more questions feel free to comment back - I'm happy to help!
The README doesn't do a good job explaining what this tool does.
Where and how am I supposed to listen to and analyze it?
It's also not quite clear what pattern is used. I can see some callback stuff going on but it's really hard to make sense of it.