generate JavaScript for analytics