Added monitor function for capturing click events