adapt logic to trackEvent solution