/ Documentation /Spectra One/Integrating Google Analytics into Spectra One Theme

Integrating Google Analytics into Spectra One Theme

This guide helps you integrate Google Analytics into your Spectra One theme to monitor website traffic and user behavior.

How to Integrate Google Analytics into Spectra One Theme:

Before you make any customizations, it’s a best practice to create a child theme to avoid affecting your main theme. If you already have a child theme, you can skip this step.

Then, you can follow the below steps to Integrate Google Analytics into Spectra One Theme.

Step 1: Access Your WordPress Dashboard

Log in to your WordPress admin dashboard. This is where you’ll be making the necessary changes to your WooCommerce category pages.

Step 2: Open the Child Theme’s functions.php File

Navigate to “Appearance” in the WordPress dashboard and select “Theme Editor.” In the Theme Editor, find and click on the “functions.php” file. This file contains the code that controls various aspects of your WordPress theme.

Step 3: Insert the Code

Once you’re in the “functions.php” file, you’ll need to insert the following code snippet:

function add_head_meta() {
    // Put the Google Analytics tracking code here
add_action( 'wp_head', 'add_head_meta');

Step 4: Copy Google Analytics Tracking Code:

– Visit the Google Analytics website and sign in with your Google account.

– Select the appropriate property for the website you want to track or create a new one if necessary.

– Once inside the property, navigate to the “Admin” section.

– Under the “Property” column, click on “Tracking Info” and then select “Tracking Code.”

– Copy the entire tracking code provided by Google Analytics.

Step 5: Inserting Tracking Code into the Function:

Paste the copied Google Analytics tracking code inside the ‘add_head_meta’ function in the ‘functions.php’ file. It should replace the comment line “// Put the Google Analytics tracking code here”.

Step 6: Save the Changes

After inserting the tracking code, click the “Update File” button at the bottom of the ‘functions.php’ editor to save your changes.

Step 7: Verification

To verify that Google Analytics is tracking your website correctly, revisit the Google Analytics dashboard after some time.

Check the “Real-Time” section to see if your own visits are being tracked in real-time. Additionally, review the “Audience” and “Acquisition” sections for more comprehensive data on your website’s traffic and user behavior.

Note: It may take some time for Google Analytics to begin collecting data after the tracking code has been added. Ensure that you have administrative access to your WordPress website before making changes to the theme files.

By following these steps, you have successfully integrated Google Analytics into the Spectra One theme, allowing you to gather valuable insights into your website’s performance and visitor behavior.

Was this doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.

On this page
Build Ultra High Performance
Websites, Without Coding

Whether you are a beginner, marketer, or professional, Spectra has the tools and resources you can rely on to succeed

Get Notified When Available

Note - You can purchase the Essential Toolkit now and easily upgrade to the Business Toolkit once it becomes available.

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.

Get your hands on Spectra Pro

Enter your name and email address to get access to Spectra Pro.