Here are steps to add Google analytics to your Magento 2 store.
- Create your Google analytics account if you don’t have one from here https://www.google.com/analytics/.
- Get your Magento 2 Google analytics tracking ID. Go to Admin-> Property -> Tracking info-> Get your ID
- Login to your Magento 2 admin panel.
- Go to stores-> configuration-> Sales -> Google API section-> Google analytics.
- Toggle enable to yes.
- In Account number section->Enter your Google tracking ID.
- Click Save config.