How To Setup Google Analytics For Drupal 8 Website

Setting up Google Analytics for a Drupal 8 powered website is as simple as it is with Drupal 7 website, luckily for us, there is a small and neat module doing the hard work for us.

Google Analytics is one of the essential modules to have for any website, see: Building Drupal 8 Website From Scratch - Part 3, Essential Modules (Pathauto, Google Analytics, Disqus)

I have been using Google Analytics to track my website performances more than 10 years ago, and without it, I would be like blind. Google Analytics helps a lot.

Now, back to the subject - How To Setup Google Analytics For Drupal 8 Website

To setup Google Analytics for your Drupal site, you'll need:

Go to www.google.com/analytics and setup your site, to get UI. From admin menu in Google Analytics, chose Create Property

Creating a new property in Google Analytics

Creating a new property in Google Analytics

As we are creating a tracking code for a website, leave the default, enter your Website name, URL, optionally you could select your industry. Click on Get Tracking ID.

On the next screen your Google Analytics Tracking ID will be displayed, like UA-XXXXXX, write it down, we will need it later. Now you are done with Google Analytics website.

Enable Google Analytics module on your Drupal site, go to analytics settings (admin/config/system/google-analytics)and enter UI number you got from Google Analytics.

Google Analytics tracking ID in Drupal 8

Google Analytics tracking ID in Drupal 8

You have some options here, but for the ease of this article, we will leave the rest settings intact.

Make sure to check on Google Analytics website, to see if statistics are actually counted.

Simple as that

Add new comment