Google Analytics

Overview

Google Analytics can track almost everything on your site and give you an insight into page views, search terms, user navigation and much more. Using the analytics data we can improve the site performance.

You will learn how to add Google Analytics to Enfold theme using a few different methods:

  • Add Google Analytics to Enfold theme using the built-in theme options.
  • How to manually add the Google Analytics tracking code to your Enfold theme.
  • How to use a Google Analytics WordPress plugin.
  • Enable Google Analytics on your site using the Google Tag Manager.

Creating a Google Analytics Account

We assume that you already have an account set up with Google Analytics. If not don’t worry, getting started with Google Analytics is not as complicated as it looks. We won’t go in full detail to create the account but here is the basic steps you need to perform:

First, signup for a free Google Analytics account.

In this step, let’s create a new “Property” so we can add our site to this Property and manage it easily in the future.

  • Click on the Admin option at the bottom left
  • Look for the “Create Property” button and click on it to proceed.

  • In this screen select the “Web” property and continue. Please note that “Apps and Web” is still a BETA version and may not work properly.

  • In the final step of creating a property, you will be prompted to enter the website details of which you want to track using google analytics. Enter the details and click on the “Create” button at the bottom.

After creating the analytics property, we are just one step away from tracking your website. We need to now copy the required analytics code and install it on our website to start tracking 🙂

To copy the analytics code click on the Admin menu and select “Tracking Code” under Tracking Info.

Set up Google Analytics

Enable Google Analytics from the theme options

Google Analytics can be enabled from Enfold Theme Options > Google Services > Google Analytics > Google Analytics Tracking Code.

Manually add tracking code

To verify your site and enable Google search console in your Google Webmaster tool, it needs to be in a specific format and this can be achieved by adding the Analytics code manually to your child theme functions.php file.

//-------------------------------
// Custom script in the head section
//-------------------------------

function gtag_script(){
?>

<!-- Google site verification -->
<meta name="google-site-verification" content="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" />

<!-- Global site tag (gtag.js) - Google Analytics -->
<!-- YOUR CODE HERE -->
<!-- End Google Tag Manager -->

<?php
}
add_action('wp_head', 'gtag_script');

Use a plugin to insert the code.

Another prefered method to install Google Analytics on WordPress sites is by using a plugin. Not only it is easy to use but also provides additionsl features to easily view your stats. Browse through some of the Google Analytics Plugins on the WordPress plugins directory. We simply cannot test all the plugins and recommend which ones to use. Most of the plugins should work fine with Enfold without any issue. Go ahead and give it a try!

Recommended Plugins

Google Site Kit