Digital MarketingDigital Marketing

TroubleshootingTroubleshooting

WordPressWordPress

How to Add Google Analytics to WordPress

Table of contents

    There are two main methods to add Google Analytics to WordPress:

    Method 1: Using a Plugin (Recommended)

    Install Google Site Kit

    1. In your WordPress dashboard, go to Plugins > Add New.
    2. Search for “Google Site Kit” in the plugin directory.
    3. Click “Install” and then “Activate” on the Site Kit by Google plugin.

    Connecting Google Analytics

    1. Once activated, you’ll see a new “Site Kit” menu in your WordPress dashboard.
    2. Click on “Start Setup” to begin the configuration process.
    3. Sign in with your Google account when prompted.
    4. Grant the necessary permissions for Site Kit to access your Google services.

    Setting up Google Analytics 4 (GA4)

    1. In the Site Kit dashboard, go to Settings > Connected Services.
    2. Look for the “Analytics” section and click on “Connect Service” if not already connected.
    3. Choose your GA4 property from the dropdown menu. If you don’t have one, you can create a new property at this stage.
    4. Once selected, click “Confirm Changes” to save your settings

    Verifying the Setup

    1. After connecting GA4, you should see both Universal Analytics (UA) and GA4 properties listed in the Analytics settings.
    2. Ensure that the option to place the analytics code is toggled on for both properties
    3. It may take up to 24 hours for data to start appearing in your GA4 dashboard.

    This method is the easiest and most user-friendly, especially for beginners.

    Method 2: Manual Installation

    1. Go to Appearance > Theme Editor in your WordPress dashboard.
    2. Open the Theme Header (header.php) file.
    3. Paste your Google Analytics tracking code just before the closing </head> tag.
    4. Click “Update File” to save changes.

    Important Considerations

    • Always back up your WordPress website before making any changes.
    • If using a child theme, add the code to the child theme’s files, *NOT* the parent theme, to prevent loss during updates.
    • Data may take up to 24 hours to appear in your Google Analytics account.
    • Consider setting up goals in Google Analytics to track specific user actions on your site, such as when they submit a contact form.