lib/utils/tracking.js/track
function track(type, event, options = {}) {
  return BbPromise.try(() => {
    const isForced = options && options.isForced;
    if (isTrackingDisabled && !isForced) return null;
    if (!cacheDirPath) return request(type, event);
    const id = uuid();
    return BbPromise.all([
      (function self() {
        return fse.writeJsonAsync(join(cacheDirPath, id), { type, event }).catch(error => {
          if (error.code === 'ENOENT') {
            return fse.ensureDirAsync(cacheDirPath).then(self, ensureDirError => {
              logError('Cache dir creation error:', ensureDirError);
            });
          }
          logError(`Write cache file error: ${id}`, error);
          return null;
        });
      })(),
      request(type, event, { id }),
    ]).then(([, requestResult]) => requestResult); // In all cases resolve with request result
  });
}