Skip to content

Instantly share code, notes, and snippets.

@maxenglander
Created June 28, 2012 22:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxenglander/3014308 to your computer and use it in GitHub Desktop.
Save maxenglander/3014308 to your computer and use it in GitHub Desktop.
Proposed product report schemas
{
client_id: $client_id,
cohort_type: $cohort_type, // Sign up date, first purchase date
cohort_bin_width: $cohort_bin_width, // Week, month, quarter, year
cohort_value: $cohort_value, // 20120407, 201204, 2012.1, 2012
// Further segmentation?
// engagement
// location
// device
pv : {
total : $total_product_views,
by_engagement: [ <product views by engagement level> ],
by_location: [ <product views by location> ],
by_tag: [ <product views by tag> ],
by_title: [ <product views by title> ]
},
qty : {},
rev : {}
}
// Period type is 'week', 'month', 'year', etc.
//
// How to handle when users want to see data in windows greater than a year?
{
client_id : $client_id,
$period_type : $period, // '201202', '20120201', etc.
pv : { // Product views
total : $total_product_views,
by_engagement : [ // Breakdown by engagement level
{ "engaged" : $pvE },
{ "active" : $pvA },
{ "optout" : $pvO }
],
by_geo : [ // Breakdown by location
],
by_tag : [ // Breakdown by tags (sorted)
{ $tag1 : $views1 },
{ $tag2 : $views2 },
{ $tagN : $viewsN }
],
by_title : [ // Breakdown by titles (sorted)
{ $title1 : $views1 },
{ $title2 : $views2 },
{ $titleN : $viewN }
]
},
qty : { // Quantity
total : $total_units_sold,
by_engagement : [
{ $level : $qteL }
],
by_tag : [
{ $tagN : $unitsN },
],
by_prc_rng: [
{ $range1: $qty1 },
{ $range2: $qty2 },
{ $range3: $qty3 }
],
by_title : [
{ $titleN : $unitsN }
]
},
rev : { // Revenue
total : $total_revenue,
by_engagement : [
{ $level : $revenueL }
],
by_title : [
{ $titleN : $revenueN }
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment