function buildUsers() {
  var arr = [];
  array.users = [];
  while(arr.length < array.settings.numberUsers){
    var r = array.personas.user[Math.floor(Math.random() * array.personas.user.length)];
    if(arr.indexOf(r) === -1) arr.push(r);
  }
  for (i = 0; i < arr.length; i++) {
    var seenDate = new Date(new Date() - (arr[i].daysFirstSeen*24*60*60*1000));
    var joinDate = new Date(new Date() - (arr[i].daysJoined*24*60*60*1000));
    var lastDate = new Date(new Date() - (Math.random()*6*60*60*1000));
    if(i < array.settings.numberKnown) {
      var row = {
        "user": {
          "id": arr[i].name,
          "attributes":{"customerId":arr[i].name, "emailAddress": arr[i].emailAddress,"sfmcContactKey": arr[i].contactKey,"dateFirstSeen": seenDate,"dateJoined": joinDate,"dateLastSeen": lastDate,"autoGenerate": true}
        }
      }
    } else {
      var row = {
        "user": {
          "anonId": createID(),
          "attributes":{ "dateFirstSeen": seenDate, "dateLastSeen": lastDate, "autoGenerate": true}
        }
      }
    }
    // pick a random Product
    var pickedItems = pickItems();
    row.user.attributes.items = pickedItems;
    row.user.attributes.category = pickedItems[0].category;
    array.users.push(row);
  }
}
// Function to build hero attribute array
Function to build hero attribute array
Function to build hero attribute array
function buildUsers() {
  var arr = [];
  array.users = [];
  while(arr.length < array.settings.numberUsers){
    var r = array.personas.user[Math.floor(Math.random() * array.personas.user.length)];
    if(arr.indexOf(r) === -1) arr.push(r);
  }
  for (i = 0; i < arr.length; i++) {
    var seenDate = new Date(new Date() - (arr[i].daysFirstSeen*24*60*60*1000));
    var joinDate = new Date(new Date() - (arr[i].daysJoined*24*60*60*1000));
    var lastDate = new Date(new Date() - (Math.random()*6*60*60*1000));
    if(i < array.settings.numberKnown) {
      var row = {
        "user": {
          "id": arr[i].name,
          "attributes":{"customerId":arr[i].name, "emailAddress": arr[i].emailAddress,"sfmcContactKey": arr[i].contactKey,"dateFirstSeen": seenDate,"dateJoined": joinDate,"dateLastSeen": lastDate,"autoGenerate": true}
        }
      }
    } else {
      var row = {
        "user": {
          "anonId": createID(),
          "attributes":{ "dateFirstSeen": seenDate, "dateLastSeen": lastDate, "autoGenerate": true}
        }
      }
    }
    var pickedItems = pickItems();
    row.user.attributes.items = pickedItems;
    row.user.attributes.category = pickedItems[0].category;
    array.users.push(row);
  }
}
function buildUsers ( ) { var arr = [ ] ; array . users = [ ] ; while ( arr . length < array . settings . numberUsers ) { var r = array . personas . user [ Math . floor ( Math . random ( ) * array . personas . user . length ) ] ; if ( arr . indexOf ( r ) === - 1 ) arr . push ( r ) ; } for ( i = 0 ; i < arr . length ; i ++ ) { var seenDate = new Date ( new Date ( ) - ( arr [ i ] . daysFirstSeen * 24 * 60 * 60 * 1000 ) ) ; var joinDate = new Date ( new Date ( ) - ( arr [ i ] . daysJoined * 24 * 60 * 60 * 1000 ) ) ; var lastDate = new Date ( new Date ( ) - ( Math . random ( ) * 6 * 60 * 60 * 1000 ) ) ; if ( i < array . settings . numberKnown ) { var row = { "user" : { "id" : arr [ i ] . name , "attributes" : { "customerId" : arr [ i ] . name , "emailAddress" : arr [ i ] . emailAddress , "sfmcContactKey" : arr [ i ] . contactKey , "dateFirstSeen" : seenDate , "dateJoined" : joinDate , "dateLastSeen" : lastDate , "autoGenerate" : true } } } } else { var row = { "user" : { "anonId" : createID ( ) , "attributes" : { "dateFirstSeen" : seenDate , "dateLastSeen" : lastDate , "autoGenerate" : true } } } } var pickedItems = pickItems ( ) ; row . user . attributes . items = pickedItems ; row . user . attributes . category = pickedItems [ 0 ] . category ; array . users . push ( row ) ; } }
Function to build hero attribute array
Function to build hero attribute array
// pick a random Product