Add analytics event code.