3

I'm trying to setup a funnel. The issue is that the "actorProperty" is being stored as an integer in the first event, and it is stored as an string in the second one.

Below an example of the JSON stored in keen (take a look at the "app_id" field):

Event 1

{ 
    "keen": { 
        "timestamp": "2014-10-17T12:28:35.000Z", 
        "created_at": "2014-10-17T12:28:35.805Z", 
        "id": "510b7481961a5ad07165" 
    }, 
    "app_id": 861, 
    "old_plan": "Trial" 
},

Event 2:

{ 
    "keen": { 
        ...
    }, 
    "metadata": { 
        "plan": "Premium", 
        "app_id": "861" 
    }
}

The funnel visualization is not working for the second event, it's not bringing any result...Below the code to generate the funnel:

var funnel = new Keen.Query('funnel', {
    steps: [
        {
            eventCollection: "Event 1",
            actorProperty: "app_id"
        },
        {
            eventCollection: "Event 2",
            actorProperty: "metadata.app_id"
        }
    ],
    timeframe: "this_month"
});

Do you have any advice on how to proceed in this case ?

tufla
  • 562
  • 6
  • 16
  • hey could you link to a jsfiddle? – Sean Oct 28 '14 at 22:39
  • mm, I don't think so, at least no with my current environment, I'll need to setup a whole test environment for the example. I'll try to find a solution before to invest time on that, sorry. – tufla Oct 29 '14 at 16:00
  • OK, Finally what I did in case is useful for someone was to query the funnel adding the argument "with_actors: true" to the first step. Then, using the query response, I map the actors of the first step to string and I execute a second query (count_unique) using "in" filter with string actors array as value. With the response of the second query I update the result value of the second step in the first query and proceed to visualize. Seems a little dirty, but it's a simple solution and works without have to modify any event data. – tufla Oct 31 '14 at 15:47

1 Answers1

3

The best way forward is to basically fix the data you have injected into Keen. Keen doesn't provide updates to existing records, but does have a good way of exporting and then re-importing the data after it's cleaned up.

Check out the keen-cli gem, which lets you do get a CSV of all the events:

keen queries:run --collection "Event 2" --analysis-type extraction --email your@emailaddress.com

Once you clean up the CSV (strip those quotes), you can re-import it:

keen events:add --file fixed_events.csv --csv

If you need to delete the records there, look at the keen collections:delete command.

  • Thank you for your answer Jay, it's certainly a really good option, however I cannot modify the Event 2 (which would be the easier) as it is generated by an external provider. So, I should modify instead the Event 1 to become it string...the problem with this option is that I'm going to mess up a bunch of other funnels and metrics for several events already using the app_id as integer...so, I'll need basically to update almost the whole collected data for my system...summarizing I'll try another option for this specific funnel before to go ahead with this solution. – tufla Oct 29 '14 at 19:14