function arrayUsers() {
  $.getJSON('/app/feeds/users.json', function(data) {
    var users = data.slice(0, array.settings.totalUsers);
    for (i = 0; i < users.length; i++) {
      if(i > array.settings.knownCount){delete users[i].id};
      if(i < array.heroes.length){
        users[i].id = array.heroes[i].id; 
        users[i].type = 'hero'; 
        array.heroes[i].anonId = users[i].anonId; 
        users[i].products = assignProducts(array.catalog.products, array.heroes[i].productId)
      } else {
        users[i].products = assignProducts(array.catalog.products);
        if(i < array.settings.cartCount){users[i].type = 'abandoner'};
        if(i < array.settings.purchaseCount && i < array.settings.knownCount){users[i].type = 'purchaser'};
      };
      users[i].sessions = arraySessions(users[i]);
      users[i].events = arrayEvents(users[i]);
    }
    array.users = users;
  }).done(function () {
    results[1] = true;
    results[2] = true;
    console.log(array);
    displayResults();
    uploadEvents();
  });
}
// Retrieve user data and assign random product
Retrieve user data and assign random product
Retrieve user data and assign random product
function arrayUsers() {
  $.getJSON('/app/feeds/users.json', function(data) {
    var users = data.slice(0, array.settings.totalUsers);
    for (i = 0; i < users.length; i++) {
      if(i > array.settings.knownCount){delete users[i].id};
      if(i < array.heroes.length){
        users[i].id = array.heroes[i].id; 
        users[i].type = 'hero'; 
        array.heroes[i].anonId = users[i].anonId; 
        users[i].products = assignProducts(array.catalog.products, array.heroes[i].productId)
      } else {
        users[i].products = assignProducts(array.catalog.products);
        if(i < array.settings.cartCount){users[i].type = 'abandoner'};
        if(i < array.settings.purchaseCount && i < array.settings.knownCount){users[i].type = 'purchaser'};
      };
      users[i].sessions = arraySessions(users[i]);
      users[i].events = arrayEvents(users[i]);
    }
    array.users = users;
  }).done(function () {
    results[1] = true;
    results[2] = true;
    console.log(array);
    displayResults();
    uploadEvents();
  });
}
function arrayUsers ( ) { $ . getJSON ( '/app/feeds/users.json' , function ( data ) { var users = data . slice ( 0 , array . settings . totalUsers ) ; for ( i = 0 ; i < users . length ; i ++ ) { if ( i > array . settings . knownCount ) { delete users [ i ] . id } ; if ( i < array . heroes . length ) { users [ i ] . id = array . heroes [ i ] . id ; users [ i ] . type = 'hero' ; array . heroes [ i ] . anonId = users [ i ] . anonId ; users [ i ] . products = assignProducts ( array . catalog . products , array . heroes [ i ] . productId ) } else { users [ i ] . products = assignProducts ( array . catalog . products ) ; if ( i < array . settings . cartCount ) { users [ i ] . type = 'abandoner' } ; if ( i < array . settings . purchaseCount && i < array . settings . knownCount ) { users [ i ] . type = 'purchaser' } ; } ; users [ i ] . sessions = arraySessions ( users [ i ] ) ; users [ i ] . events = arrayEvents ( users [ i ] ) ; } array . users = users ; } ) . done ( function ( ) { results [ 1 ] = true ; results [ 2 ] = true ; console . log ( array ) ; displayResults ( ) ; uploadEvents ( ) ; } ) ; }
Retrieve user data and assign random product
Retrieve user data and assign random product