Add Google Analytics to Astra WordPress Theme

Chart with text "Add Google Analytics to Astra Theme"

Today I’m going to show you how to add Google Analytics to Astra WordPress theme.

This post assumes that you have created your website using Astra and are ready to start collecting visitor data.

You’ll want to add Google Analytics tracking code to your website so that you can track basic visitor data such as user behavior, demographics, top landing pages and more.

But before you can add that code, you need to have a Google Analytics account.

Create Your Google Analytics Account

If you don’t yet have one, you can create an account at and set up a website property in your Analytics account.

From there you can obtain your website tracking code:

  1. Log into Google Analytics
  2. Go to Admin>Property
  3. Under Property Column, click Tracking code
  4. And then Ctrl + C to copy the code or Cmd + C to copy the code on a Mac

Next, make sure you have a good backup!

Now we are ready to add Google Analytics to Astra.

There are two ways that you can add the code depending on whether or not you are using the free Astra theme.

And I’ll show you both ways.

Method 1: Using the Free Astra Theme

If you are using the free Astra theme, you will need to install and activate the Astra Hooks Plugin.

Install Astra Hooks Plugin

Next we need to add the tracking code into the customizer.

And we’ll want to place that tracking code into the website header.

Add Google Analytics to Astra Website Header

If you need more detailed instructions, you can refer to the following short video.

Short Demo on How to Add Google Analytics to Astra WordPress Theme

And now the Google Analytics tracking code has been added to your site using the Astra Hooks plugin.

Method 2: Using Astra Pro Plugin

If you are using the paid Astro Pro plugin, it is recommended that you use the custom layouts module to add Google Analytics to Astra.

Remember, for this method, you need to have the Astra Pro Plugin installed and activated. You’ll also need to have the custom layouts module activated.

I’ll show you how to do both.

From the dashboard Go to Appearance > Astra Options

Note the available modules for Astra Pro as per the following screenshot.

Scroll down and make sure custom layouts is activated.

Screenshot of Available Astra Pro Modules

Next we want to create a new custom layout.

From the dashboard:

See the following screenshot for settings but make sure you are using your tracking code ~ not the sample code in the screenshot!

Screen Shot of Astra Custom Layout Options
How to Add Google Analytics to Astra Using Astra Pro Plugin

The tracking code has now been added to your site using Astra Pro.

For your convenience, you may want to refer to the following video that demonstrates both of these methods.

I hope that this tutorial has been helpful to you!

Please feel free to add your comments and questions below. I’m always happy to help!

Related Posts:

Leave a Reply

1 Comment threads
1 Thread replies
Most reacted comment
Hottest comment thread
2 Comment authors
Michelle PhillipsMaAnna Recent comment authors
newest oldest most voted
Notify of

Fantastic and helpful post, Michelle. Thrilled to know Analytics is so easy to do in Astra.

Scroll to Top

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.