added analytics codes and events