Updated on Mar 13, 2019
Being able to track the traffic on your Magento 2 website will enable you to better manage the products on your store and have more customers. Google Analytics has you covered when it comes to traffic tracking.
To obtain this tracking ID you have to create an account with Google Analytics.
Select the Sign in with Google Analytics option and click Sign up.
Fill the account details and scroll to the bottom of the page to click on the Get Tracking ID button.
Now you will have to accept the Google Analytics Terms of Service, if you read and agreed with them.
You will now have to copy the tracking ID in preparation for the next step.
Login to your Magento 2 admin area and navigate to Stores → Configuration.
Access the Sales>Google API section, expand the Google Analytics option, Enable it and paste the tracking code in the Account Number field. Also click on the Save Config button to apply the changes.
Wait a few minutes for the traffic data to load in your Google Analytics dashboard and you will be able to track the activity on your website.