changed the code to include analytics