There are two ways to add Google Analytics to your dashboard.
Here we are going to show you how you can do this:
1- By plugins:
Some plugins can help you in this way. Check them out:
Google Analytics for WordPress by MonsterInsights
Google Analytics Dashboard for WP by ExactMetrics (formerly GADWP)
2- The other way is to use javascript codes. You can copy and paste the following codes to the theme’s custom JS section. Then replace your Google ID with the sample ID:
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-XXXXX-Y', 'auto'); ga('send', 'pageview');
Dashboard > Theme Settings > Additional Scripts > Custom JS