Javascript library to track events using regular expression