angulartics.waitForVendorApi('mixpanel', 500, function (mixpanel) {
    $analyticsProvider.registerSetUsername(function (userId) {
      mixpanel.identify(userId);
    });
  });