track event before changing window location