You will first need to register your website in Google analytics tool and then generate the analytics code. Inserting the analytics code into the webpage source helps to track and your website traffic and generate various results in the Google analytics tool.
Go to https://www.google.com/analytics/ and click on Access Google Analytics at the top right.
Once you are logged in, click on Admin at the top.
In the middle Property column, click on the dropdown and Create new property.
Fill in your website details and click Get Tracking ID button.