Adding Google Analytics to your WordPress website can provide you with valuable insights into your website’s traffic and user behavior.
Table of Contents
ToggleMethod 1:
Here’s a step-by-step guide on how to add Google Analytics to your WordPress site:
Create a Google Analytics Account:
If you don’t already have a Google Analytics account, you’ll need to create one by visiting the Google Analytics website and signing in with your Google account.
Access your Google Analytics Tracking Code
After logging into Google Analytics, you can obtain the tracking code by navigating to your desired property and finding the tracking code in the Admin settings. As like this
<!– Global site tag (gtag.js) – Google Analytics –>
<script async src=”https://www.googletagmanager.com/gtag/js?id=YOUR-GA-CODE”></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag(‘js’, new Date());
gtag(‘config’, ‘YOUR-GA-CODE’);
</script>
Access the Theme Code Editor:
Log into your WordPress dashboard, go to ‘Appearance,’ and choose ‘Theme Editor’ from the menu. Select BuddyX Theme, and you can access the theme editor there.
Insert the Google Analytics tracking code:
Open the header.php file and find the </head> tag. Paste the Google Analytics tracking code just before the closing </head> tag.
Your Google Analytics tracking code should look similar to this:
Save the Changes
After inserting the tracking code, click the ‘Update File’ button to save the changes.
Verify the Installation
To ensure that Google Analytics is working, go back to your Google Analytics account and check the ‘Real-Time’ section for any incoming traffic data.
Method 2:
To add Google Analytics to your WordPress site using the SEO Kit plugin, follow these steps:
Install and Activate the SEO Kit Plugin
Go to the WordPress dashboard, navigate to “Plugins” and click on “Add New.” Search for “SEO Kit,” install the plugin, and activate it.
Connect SEO Kit with Google Analytics
After activating the plugin, go to “SEO Kit” in the WordPress dashboard and select “General Settings.” Look for the “Google Analytics” section. You will likely find a field where you can input your Google Analytics Tracking ID or a place to connect your Google Analytics account.
Obtain Google Analytics Tracking ID
If you don’t have a Google Analytics account, you will need to sign up for one. Once you have an account, you can obtain the tracking ID from the Admin section of your Google Analytics account.
Insert Tracking ID into SEO Kit
Copy and paste the Google Analytics Tracking ID into the appropriate field in the SEO Kit plugin settings.
Save Changes and Verify
Save the changes in the SEO Kit settings. After saving, Google Analytics should start tracking your WordPress site’s data.
By following these steps, you should be able to integrate Google Analytics into your WordPress site using the SEO Kit plugin. This will allow you to track and analyze various metrics related to your website’s traffic and performance.
Interesting Reads:
How To Add Meta Tags In WordPress?