1

I have a local countly installation, I have been able to make it multi tenet, now any dev from my organization can make an account on it, make applications under his account, and send data on it.

We would like to add some more data to our dashboard, like "Gender","age" e.t.c, and that I suppose will be in form of another metric like "device details" and "carriers", I would like know how do we add a custom metric to it.

I am new to nodejs and express, but I am getting hang of it, so just elementary know how will do, anyways I am reading code at the moment, so If I realize how to do it, i'll post it here as well.

Brij Raj Singh - MSFT
  • 4,903
  • 7
  • 36
  • 55
  • Onur from Support staff of countly replied " Hi Brij, This is the part where we process all items inside the _metrics object from the begin_session API call. You can simply extend it by adding your own metrics. You will also need a read API root for your new metric. The hardest part would be displaying it on your dashboard. The easiest way is to study one of the existing view, like users view, and built a similar mechanism. Alternatively you can store this information using the custom event system. -Onur " – Brij Raj Singh - MSFT Jan 06 '14 at 07:47

1 Answers1

1

There is a generic piece of code which gets the params from incoming http request, and throws them to the db, like all other params, the new collection is also made by this process automatically.

in file api/parts/data/usage.js

 var predefinedMetrics = [
            { db: "devices", metrics: [{ name: "_device", set: "devices", short_code: common.dbUserMap['device'] }] },
            { db: "carriers", metrics: [{ name: "_carrier", set: "carriers", short_code: common.dbUserMap['carrier'] }] },
            { db: "device_details", metrics: [{ name: "_os", set: "os", short_code: common.dbUserMap['platform'] }, { name: "_os_version", set: "os_versions", short_code: common.dbUserMap['platform_version'] }, { name: "_resolution", set: "resolutions" }] },
            { db: "app_versions", metrics: [{ name: "_app_version", set: "app_versions", short_code: common.dbUserMap['app_version'] }] },
            { db: "gender", metrics: [{ name: "_gender", set: "gender", short_code: common.dbUserMap['gender'] }] }]

I just added gender to this list of predefined metrices, and now when i send the gender along with my http request, it gets saved easily.

Now I am working on rendering it on dashboard.

Brij Raj Singh - MSFT
  • 4,903
  • 7
  • 36
  • 55