common-web icon indicating copy to clipboard operation
common-web copied to clipboard

I don't understand what this tool does.

Open dAnjou opened this issue 11 years ago • 3 comments

The README doesn't do a good job explaining what this tool does.

CommonWeb is an open source JavaScript library that transforms common web user activity into a stream of event data you can listen to and analyze.

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.

dAnjou avatar Mar 27 '15 12:03 dAnjou

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.

tiagoaf5 avatar Mar 29 '15 22:03 tiagoaf5

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;

josephwegner avatar Apr 01 '15 21:04 josephwegner

@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!

josephwegner avatar Apr 14 '15 14:04 josephwegner