Google Analytics on WordPress

The most frequent questions asked about Google Analytics on a WordPress site gets answered.

How do I add Google Analytics to WordPress?

There are several ways to add Google Analytics to WordPress. A Google Analytics code can be embedded directly into WordPress templates. This is an option, but it is not commonly used because there is a large variety of plugins that can be used to add Google Analytics to WordPress. Most plugins have additional helpful features, like displaying Google Analytics data in the WordPress backend or connecting other systems, like Facebook and AdWords, to WordPress in addition to with Google Analytics.

One recommended option is Google Tag Manager. This is a popular option because it is the most flexible and allows you to connect multiple different systems to the WordPress without making any changes to the source code. Google Tag Manager can be embedded directly into WordPress templates, but I typically use DuracellTomi’s Google Tag Manager for WordPress (https://wordpress.org/plugins/duracelltomi-google-tag-manager/). The plugin not only makes it possible to integrate Google Tag Manager into WordPress, but also pushes some important data into the dataLayer, including:

  • post/page titles
  • post/page dates
  • post/page category names
  • post/page tag names
  • post/page author ID and names
  • post/page ID
  • post types
  • post count on the current page + in the current category/tag/taxonomy
  • logged in status
  • logged in user role
  • logged in user ID logged in user email address
  • search data
  • site name and ID for WordPress multisite instances
  • ecommerce interactions
  • product data

Configuring dataLayer without this plugin would require a lot of time and programming efforts. Having all these data points in dataLayer makes it possible to send this data further to a variety of marketing systems, including Google Analytics, Facebook, Twitter and so on.

Basic installation of this plugin requires entering the GTM ID in the plugin and configuring the UA tracking tag inside GTM. Detailed instructions on how to install the plugin can be found here.

What are the best Google Analytics WordPress plugins?

There are a number of different Google Analytics plugins that can be used for WordPress to help implement advanced Google Analytics tracking.

In reality, however, there are very few WordPress users who need to integrate only Google Analytics and nothing else. Normally, users want to integrate not only Google Analytics, but also Facebook, AdWords, AdRoll, Twitter, LinkedIn, affiliates and other pixels. In the past, the way to integrate all these tracking pixels was by using separate plugins or by editing the theme templates.

A smarter way is to use Google Tag Manager to implement all the pixels at once. You will have the following structure: WordPress + Plugin to implement GTM + GTM Container with Google Analytics and other remarketing and conversion tracking pixels inside the container.

GTM container integration on WordPress is not very complicated, but to set up advanced tracking, you need to have dataLayer with a number of different events and data points that are important to track for your site.

DuracellTomi’s Google Tag Manager for WordPress (https://wordpress.org/plugins/duracelltomi-google-tag-manager/) is the best for GTM implementation. It implements not only the GTM code into each page of the WordPress site, but also pushes a lot of useful data points and events into dataLayer:

  • post/page titles
  • post/page dates
  • post/page category names
  • post/page tag names
  • post/page author ID and names
  • post/page ID
  • post types
  • post count on the current page + in the current category/tag/taxonomy
  • logged in status
  • logged in user role
  • logged in user ID logged in user email address
  • search data
  • site name and ID for WordPress multisite instances
  • ecommerce interactions
  • product data

With the help of this plugin, it is possible to build very advanced tracking for WordPress sites within a couple of hours. It also supports multi-site and form tracking.

Say Goodbye to Old Analytics Tools

Get a mind-blowing, personalized dashboard, automatically created.

Try it free