How to set up a Google Analytics account and add your tracking code to WordPress using the HFCM plugin

Apr 20, 2025
 

By Lorna Walker

Why Google Analytics matters for your small business

If you're running a small business or managing marketing on a tight budget, understanding your website visitors is crucial for making smart decisions that actually grow your business. Google Analytics gives you the insights you need without the hefty price tag of expensive marketing tools.

For small business owners and solo marketers, Google Analytics answers essential questions like:

  • Which marketing efforts are bringing in the most visitors?
  • What content resonates most with your audience?
  • Are people finding what they need on your website?
  • When are your customers most active online?

What is Google Analytics 4 and why you need it

Google Analytics 4 (GA4) is the current version of Google Analytics, and it's designed to give you a clearer picture of your customer journey across different devices and platforms. 

The good news is that GA4 has become much more user-friendly since its introduction. In 2025, Google has improved the onboarding experience and made the interface more intuitive for beginners. The platform now includes AI-assisted navigation that helps you find the information you need more easily.

Key benefits of GA4 for small businesses include:

  • Enhanced automatic tracking: GA4 automatically tracks important interactions like scrolling, clicking external links, and file downloads without requiring additional setup
  • Mobile-first approach: Perfect for today's mobile-dominated web, where over 60% of website traffic comes from mobile devices
  • Privacy-focused: Built to comply with modern privacy regulations whilst still providing valuable insights
  • Event-based tracking: More flexible than older versions, allowing you to track specific actions that matter to your business

Why choose the HFCM plugin over other methods

Whilst there are several ways to add Google Analytics to your WordPress website, the Header Footer Code Manager (HFCM) plugin offers the perfect balance of simplicity and reliability for small business owners.

 Theme-independent

Unlike manually editing theme files, HFCM ensures your tracking code won't disappear when you update or change your WordPress theme. This is crucial for maintaining consistent analytics data.

Easy management

You can easily turn tracking on or off, manage multiple code snippets, and see exactly what's active on your website—all from one simple interface. No technical expertise required.

Targeted placement

HFCM allows you to place your tracking code exactly where it needs to go and even exclude it from specific pages if needed. This level of control is particularly useful for GDPR compliance.

Step 1: Create your Google Analytics 4 account

Setting up your Google Analytics account is straightforward and completely free. You'll need a Google account to get started—if you use Gmail or any other Google service, you already have one.

Create your analytics property

  1. Visit analytics.google.com and click "Start for free"
  2. Sign in with your Google account
  3. Click "Start measuring" to begin the setup process
 

Configure your account details

  1. Account name: Enter your business name or website name
  2. Property name: Use your website name (e.g., "My Business Website")
  3. Reporting time zone: Select your local time zone
  4. Currency: Choose your business currency (GBP for UK businesses)
 

Set up your data stream

  1. Select "Web" as your platform
  2. Enter your website URL (e.g., https://yourbusiness.co.uk)
  3. Enter a stream name (your website name works perfectly)
  4. Ensure "Enhanced measurement" is turned on—this automatically tracks useful interactions like scrolling and clicks
  5. Click "Create stream"
 

Copy your tracking code

After creating your stream, you'll see your Measurement ID (it looks like G-XXXXXXXXXX). You'll also see the complete tracking code. Copy the entire tracking code—you'll need this for the next step.

Step 2: Install the Header Footer Code Manager plugin

Installing HFCM is just like adding any other WordPress plugin. The process takes less than two minutes and requires no technical knowledge.

Install from your WordPress dashboard

  1. Log into your WordPress admin area
  2. Navigate to Plugins → Add New Plugin
  3. Search for "Header Footer Code Manager"
  4. Look for the plugin by 99 Robots (it should be the first result)
  5. Click "Install Now"
  6. Once installed, click "Activate"
 

After activation, you'll see "HFCM" appear in your WordPress admin menu on the left side. This is where you'll manage your tracking codes and other snippets.

Step 3: Add your GA4 tracking code using HFCM

Now comes the crucial step: adding your Google Analytics tracking code to your website. HFCM makes this process simple and safe.

Create a new snippet

  1. In your WordPress admin, click on "HFCM" in the left menu
  2. Click "Add New Snippet"
  3. Give your snippet a clear name like "Google Analytics GA4 Tracking"
 

Configure your snippet settings

  1. Snippet/Code: Paste your complete GA4 tracking code (the one you copied from Google Analytics)
  2. Display on: Select "Site Wide Header" (this ensures the code loads on every page)
  3. Device type: Leave as "Show on All Devices"
  4. Status: Ensure it's set to "Active"
 

Save and activate

Click "Save" to store your snippet. The tracking code is now active on your website and will begin collecting data immediately.

Step 4: Verify your tracking is working

It's important to confirm that your tracking code is working correctly. Google Analytics provides several ways to check this.

Check real-time reports

  1. Go back to your Google Analytics account
  2. Navigate to Reports → Real-time
  3. In another browser tab, visit your website
  4. You should see your visit appear in the real-time report within a few seconds
 

Use Google Tag Assistant

For a more thorough check, you can use Google Tag Assistant (a free browser extension) to verify that your tracking code is firing correctly on your website.

Wait for data collection

Whilst real-time reports show immediate activity, your full analytics reports will begin populating within 24-48 hours. Don't worry if you don't see comprehensive data immediately—this is completely normal.

Essential GA4 settings for small businesses

Once your tracking is active, there are several important settings to configure that will make your analytics more useful for business decision-making.

Set up key events (conversions)

Key events help you understand when visitors complete important actions on your website. Common examples for small businesses include:

  • Contact form submissions
  • Phone number clicks
  • Email link clicks
  • Brochure downloads
  • Newsletter signups
 

Configure Enhanced Measurement

Enhanced Measurement automatically tracks useful interactions without requiring additional setup. Ensure these are enabled:

  • Page views (enabled by default)
  • Scrolls (tracks engagement)
  • Outbound clicks (links to other websites)
  • Site search (if you have a search function)
  • File downloads (PDFs, documents, etc.)

Set up audience demographics

Enable Google signals to get insights about your visitors' age, gender, and interests. This information helps you understand your audience better, but remember it's aggregated and anonymous data only.

Understanding your Google Analytics reports

GA4 can seem overwhelming at first, but focusing on key reports will give you the insights you need to grow your business.

Traffic acquisition report

This report shows how people find your website:

  • Organic search: Visitors from Google, Bing, etc.
  • Direct: People typing your URL directly
  • Referral: Visitors from other websites
  • Social: Traffic from social media platforms
  • Paid search: Visitors from advertising campaigns
 

Pages and screens report

Discover which pages are most popular and how visitors engage with your content. Look for:

  • Pages with high views but short engagement—these might need improvement
  • Your most popular content—consider creating similar content
  • Pages with high bounce rates—visitors might not find what they expect

 

Common issues and how to fix them

Even with careful setup, you might encounter some common issues. Here are the most frequent problems and their solutions:

No data appearing after 48 hours

  • Check your tracking code: Ensure it's correctly pasted in HFCM without any missing characters
  • Verify snippet placement: Make sure "Site Wide Header" is selected
  • Confirm snippet is active: Check that the status shows "Active" in HFCM
  • Clear caching: If you use caching plugins, clear the cache and wait a few hours

Duplicate tracking codes

If you see inflated numbers, you might have multiple tracking codes active. Check for:

  • Other analytics plugins still running
  • Multiple HFCM snippets with the same code
  • Tracking code manually added to theme files

HFCM plugin conflicts

Rarely, HFCM might conflict with other plugins. If you experience issues:

  • Deactivate other plugins temporarily to identify conflicts
  • Ensure HFCM is updated to the latest version
  • Check that your WordPress installation is up to date
 

Next steps to improve your website performance

Now that you have Google Analytics tracking your website, you can start making data-driven decisions to grow your business.

Regular monitoring schedule

Set aside time each week to review your analytics data. Focus on:

  • Which content attracts the most visitors
  • How people find your website
  • Whether your marketing efforts are working
  • Pages that might need improvement

Content optimisation

Use your analytics data to:

  • Create more content similar to your most popular pages
  • Improve pages with high bounce rates
  • Optimise for the keywords bringing you traffic
  • Understand what questions your audience is asking

Technical improvements

Monitor your website's performance and consider:

  • Improving page load speeds for better user experience
  • Ensuring your website works well on mobile devices
  • Making navigation clearer based on user behaviour
  • Adding more clear calls-to-action on popular pages

Stay compliant with privacy regulations

Remember to:

  • Update your privacy policy to mention Google Analytics
  • Consider implementing a cookie consent banner if required
  • Review your data retention settings in Google Analytics
  • Understand your obligations under GDPR and other privacy laws

About the author

Lorna has been working in digital marketing for more than 20 years now, both running campaigns for her own businesses as well as working on behalf of clients. She particularly enjoys helping clients learn how to take control of different aspects of their digital marketing themselves, making the best use of the tools that are available to them and getting them out from under reliance on developers and agencies to do things for them, empowering them to do these things themselves.

Struggling to implement these strategies in your own business? You're not alone. Join our training webinars designed specifically for small and medium businesses ready to take their digital marketing to the next level. View our complete list of upcoming topics and training sessions.

Find out more