add trigger function for capturing external events