To enable google analytics, basically you need to have a google analytics account with tracking ID. I will not be covering this topic in this article. Will write a new article on this process.
Refer: https://www.google.com/analytics/ for more information
Let us configure Magento 2 administration panel. (I am assuming that you have a Tracking ID ready with you.)
Login to Administration panel of magento 2 portal
Go to Stores > Configuration
Choose Sales tab, choose google API
Put your Google Tracking ID
You will need to clear your cache by going to: System > Cache Management & Click Flush Magento cache
To verify your changes, please visit store portal & view source to find your Google analytics code added to portal at bottom of page.
Note: This configuration was tested on Magento 2.1.9