1

I am using Segment.io JAVA SDK to collect the events from my application and using Keen.io to represent the same visually. I have a hierarchical event structure as follows,

  • Company
    • Department
      • User (login, logout)
        • Book (open, close)
          • Page (view, next, previous)
        • Vehicle (start, drive, stop)

So, when collecting the data in segment, should we send all the properties in all the events to do analysis later (in keen.io or any other tools) as follows,

Identify user, and track

login: company-id, dept-id, timestamp

book-open: company-id, dept-id, timestamp, book-id, book-name

page-view: company-id, dept-id, timestamp, book-id, book-name, page-id

vehicle-start: company-id, dept-id, timestamp, vehicle-id, vehicle-name

or

Should we just identify the user, and track the events by just sending the relevant properties

login: company-id, dept-id, timestamp

book-open: timestamp, book-id, book-name

page-view: timestamp, page-id

vehicle-start: timestamp, vehicle-id, vehicle-name

In the 2nd case, how can we identify that the "page-view" event is for which book ?

Any help would be greatly appreciated.

Thanks

KayKay
  • 553
  • 7
  • 22

2 Answers2

1

I would definitely suggest sending all the data in the Keen events. The richer the data you send, the richer the querying you will be able to do in the future.

To answer your specific question, if you send the book id for a page-view event, you can do a query like this:

var popular_books = new Keen.Query('count', { event_collection: 'page-view', timeframe: "this_2_months", group_by: 'book_id' });

That will return back a response showing how many page-views you got on each book!

jwegner
  • 7,043
  • 8
  • 34
  • 56
1

Your data model in Keen IO will have 4 event collections:

  1. login
  2. book-open
  3. page-view
  4. vehicle-start

On each event, you will have a hierarchy of data about the event, the user, the page, the book, and any other relevant context. There isn't a separate concept for "identifying" the user in Keen IO - you'll describe the user and everything you know about them at that point in time right on event.

For example, for a vehicle-start event you might have:

vehicle-start-event = {
    company: "Airbnb",
    department: "Z5",
    vehicle : {
        name: "Blue Falcon",
        id: "8d2fe5",
    },
    user: {
        name: "Lara Croft",
        id: "923hniansd909niowoasdl"
    }
 }

For a login event you would have:

login-event = {
    company: "Airbnb",
    department: "Z5",
    user: {
        name: "Lara Croft",
        id: "923hniansd909niowoasdl"
    }
}

You asked, "how can we identify that the "page-view" event is for which book?"

The answer is to store the related book at the time the pageview happens, right on the event. That whenever you run queries on the pageviews, you have the book name right there on the event.

pageview-event = {
    company: "Airbnb",
    department: "Z5",
    user: {
        name: "Lara Croft",
        id: "923hniansd909niowoasdl"
    },
    book: {
        name: "Where the Wild Things Are",
        id: "293as0d90fjw3"
    },
    page: {
        title: "Wild Thing",
        number: 4
    }
}

Then you could do a query like count "pageviews grouped by book" to see all of the pageviews by book, or count pageviews of a particular user or page and group by book to see what book they were part of.

https://keen.io/blog/44565580467/event-data-vs-entity-data-how-to-store-user

Michelle Wetzler
  • 734
  • 4
  • 16