add error codes and tracking events