How can I identify users who performed an action X times? [Passionate]

We plan to use Keen as our tracking core, but combining queries and retrieving data is a big problem for us.

If we have, for example, one collection with a name pageviews, with a user as its property (for example:) {"name": "pageviews", "properties":{"user":{"id":"4242"},"url":"https://keen.io/"}}and another collection with a name purchaseswith the same property userinside:

  • How can we get the number of unique users who visited at least 3 times a single URL and completed one other “purchase” event?

  • How can we get these people out? Is it possible to do this with Amazon S3 data replication? (with Amazonian Athena?). The extraction function does not seem to satisfy our extraction problem, since we cannot use the group by operators, and we cannot combine several events to extract (am I mistaken?).

Our goal is to use Keen not only as a statistical analyzer, but also as powerful data support for our use of segmentation / extraction.

+4
source share
1 answer

Here are a few solutions to this problem:

1: ? Keen funnel , ( ) A, B, C .. filter . ? , :

  • /keen.io/
  • /keen.io/products

.

2: . , . -, select_unique, , (). count group_by user.id, , . 1 2, , . , 3 .

var client = new Keen({
  projectId: "PROJECT_ID",
  readKey: "READ_KEY"
}); 

var usersWhoPurchased = []

// Query 1
var usersWhoPurchasedQuery = new Keen.Query("select_unique", {
  event_collection: "purchases",
  target_property: "user.id",
  timeframe: "this_7_days"
});

// Get Query 1 Results
client.run(usersWhoPurchasedQuery, function(err, response){
  usersWhoPurchased = response['result']
});


// Query 2
var activityCountsByUserQuery = new Keen.Query("count", {
  event_collection: "pageviews",
  group_by: "user.id",
  timeframe: "this_7_days",
  filters: [
  	{
  	  property_name: "url",
  	  operator: "eq",
  	  property_value: https://keen.io/
  	},
  	{
  	  property_name: "user.id",
  	  operator: "in",
  	  property_value: usersWhoPurchased
  	}
  ]
});
    
// Get Query 2 Results
client.run(activityCountsByUserQuery, function(err, response){
  console.log(response)
  var countsByUser = response['result']
});


// countsByUser = [
//   {
//     "user.id": "A",
//     "result": 1
//   },
//   {
//     "user.id": "B",
//     "result": 0
//   },
//   {
//     "user.id": "C",
//     "result": 3
//   }
// ]
// Sort countsByUser to identfy those with >3

, ( ID). .

3: . , , . , . , :

{  
   "collection_name":"pageviews",
   "properties":{  
      "user":{  
         "id":"4242"
      },
      "url":"https://keen.io/",
      "product_views_this_session":4
   }
}

, .

4: , S3 Streaming + AWS Lambda + RDS DynamoDB

, Keen Amazon S3. .

:

:

{  
   "collection_name":"user_product_view_enriched",
   "properties":{  
      "user":{  
         "id":"4242"
      },
      "url":"https://store.io/productA45",
      "view_history":{  
         "product":"A45",
         "lifetime_views":5,
         "counting_since":"<timestamp>"
      }
   }
}

Keen , 3:

  • user_product_view_enriched "A45" lifetime_views > X
  • ,

, , . , , , 3 , . S3, , , , bigga.

5: S3 EMR / Athena

S3 , . , , , .

+4

Source: https://habr.com/ru/post/1678405/


All Articles