1. In case you don't feel confident in working with a Child theme, you still can add Google Analytics or other CSS/Java scripts. Download the Simple Header Footer HTML plugin from here: https://wordpress.org/plugins/simple-header-footer-html/

Install and activate it following the provided instructions. 

You can configure the Simple Header Footer HTML plugin in Dashboard > Settings:

2. In case you're confident in working with child themes, please get a child theme (http://vamtam.com/child-themes/) and put your code the child theme's header.php. You can copy the original header.php from the main theme to the child.