Add analytics code to track messages sent (experimental)