Go to https://www.google.com/analytics/

Click on sign up

Fill out your website details and click on get the tracking id

Copy your tracking ID-

Now connect Google Analytics to your Magento site.
Go to System-> configuration

In the left panel, click on Google API

toggle Enable to yes and enter your GA id in the account number section

That’s it! you have added Google Analytics to your Magento store successfully.