Are you a Drupal website owner? Are you a content marketer? Are you a digital marketer or a Drupal developer? If your answer to any of these questions is true, then you might know how important it is to be able to keep track of the statistics of your websites. One tool that stands out and probably beats all others in terms of popularity when it comes to website analytics is Google Analytics.
The case for Google Analytics’ popularity stands even when you look at its usage amongst Drupal sites only. As is the case with most of Drupal’s extendable functionality, there’s a module for integration of Google Analytics with Drupal called simply Google Analytics, and when you check out the module’s usage statistics report, you’ll come to know that over 400,000 Drupal sites in total use Google Analytics.
While the popularity of Google Analytics in the Drupalsphere itself is a solid reason to use the tool for your website’s tracking and statistics, it isn’t the only one. Google’s tool itself is so vast and it holds so much of functionality that there are entire courses dedicated to learning Google Analytics itself on the web.
So now that we’ve established some pretty solid reasons to use Google Analytics for our Drupal sites, it might be good to know how using a module helps. The way the tool works is that it gives you a tracking code which you can put an on a web page to track it. This works well if you’ve got a site with few pages, but becomes a headache if you’ve got a complex site with a lot of pages. This is where the Google Analytics module comes to save you, as it only requires you to paste the tracking code in a single place and enables tracking of every page on your website – WIN!!
Now, let’s take a look at how you can integrate Google Analytics with Drupal, specifically Drupal 8.
Create or Login to Google Analytics Account
First, if you don’t already have a Google Analytics account, create one.
Enter the appropriate details. In website URL, enter the URL of the website you wish to track. After you are done, scroll down to the bottom and click the blue Get Tracking ID button. Accept the terms and services, after which you will be taken to the page in the screenshot below, containing your Tracking ID.
Install and Configure Google Analytics Module
Now, navigate to your Drupal 8 site and install the Google Analytics Module. After enabling the module, navigate to admin -> configuration -> Google Analytics. Here, you will see all the settings for the module. This is also where you will paste the tracking ID you got from the last step.
Paste the tracking code under the Web Property ID and you’ll be all set to start tracking your site. If you want to, you can also set further settings like tracking specific domains, blacklisting specific pages etc.
Conclusion
That’s it! You should have successfully integrated Google Analytics with your Drupal site if you followed this tutorial correctly. For a tool that offers so much functionality, it truly is amazing how easy it is to integrate it to Drupal thanks to the amazing community behind it.