Locating Your Google Analytics (GA4) Code for WordPress

On this page
  1. How to Find Your Code (Step-by-Step)
  2. Where to Place the Code in WordPress
  3. 2026 Verification Checklist
  4. Summary

In April 2026, the process for getting your tracking code remains centered on the Google Tag (gtag.js). Since the retirement of Universal Analytics, you are looking specifically for a Measurement ID (which starts with G-) rather than the old “UA-” code.

On your mybox WordPress site, you generally have two choices: use just the ID (if using a plugin) or the full Code Snippet (if adding it manually).


How to Find Your Code (Step-by-Step)

  1. Log in to Google Analytics: Go to analytics.google.com.
  2. Navigate to Admin: Click the Admin (gear icon) in the bottom-left corner.
  3. Open Data Streams: Under the Data collection and modification section (Property column), click Data Streams.
  4. Select Your Website: Click on your active web stream. This opens the Web stream details.
  5. Identify Your ID: Your Measurement ID (e.g., G-XXXXXXXXXX) is displayed in the top right. Copy this if you are using a plugin.
  6. Get the Full Code: Scroll down to the Google tag section and click View tag instructions.
    • Select Install manually.
    • Copy the entire JavaScript snippet that begins with “.

Where to Place the Code in WordPress

Once you have your code or ID, choose the method that best fits your technical comfort level on mybox:

Method A: The Official Plugin (Recommended)

Use Site Kit by Google. It’s the most stable way to connect your site without touching a single line of code.

  • Action: Install the plugin, click “Sign in with Google,” and it will automatically find your G- ID and place the code for you.

Method B: Lightweight “Insert Headers” Plugin

If you don’t want a heavy plugin like Site Kit, use Header Footer Code Manager or WPCode.

  • Action: Create a new “Snippet,” select “Header,” and paste the full gtag.js code you copied from Google. This ensures the code stays active even if you change your WordPress theme.

Method C: Manual Theme Edit (For Advanced Users)

You can paste the code directly into your theme files, but be careful: if you update your theme, this code may be overwritten unless you use a Child Theme.

  • Action: Go to Appearance ➜ Theme File Editor and find header.php. Paste the code immediately after the opening <head> tag.

2026 Verification Checklist

Test Tool Expected Result
Real-time Check GA4 Dashboard ➜ Reports ➜ Real-time You should see “1 user” (you) active on the site.
Debug Mode Google Tag Assistant A green icon confirming your G- ID is found.
Consent Mode Cookie Banner In 2026, ensure your code only fires after the user accepts cookies to remain GDPR compliant.

Export to Sheets

Summary

The “secret key” for your mybox analytics is the Measurement ID. Whether you paste the full code manually or just use the ID in a plugin, ensure it is placed in the Header so it loads before the rest of your content for the most accurate data.

Didn't find an answer?

Our support team is here for you 24/7 – write to us and we will help you sort it out.