events analytics code without "if try"