Skip to content

Google Analytics Plugin

The Google Analytics plugin adds Google Analytics 4 (GA4) tracking to your storefront. It automatically inserts the GA4 tracking code on every storefront page so you can monitor visitor behavior, traffic sources, and conversions.

What It Does

  • Adds the GA4 tracking script to the <head> of all storefront pages
  • Tracks page views automatically on every page load
  • Works with all GA4 features (audience reports, real-time data, conversions, etc.)
  • Does not affect admin panel pages -- tracking is storefront-only

Requirements

  • A Google Analytics 4 account (the newer version of Google Analytics)
  • A GA4 Measurement ID (starts with G-, for example G-QWGCB9M166)

TIP

If you do not have Google Analytics yet, sign up for free at analytics.google.com. It only takes a few minutes to create an account and property.

Getting Your Measurement ID

  1. Go to analytics.google.com and sign in
  2. Click the Admin gear icon (bottom left)
  3. Under your property, click Data Streams
  4. Click on your web data stream (or create one if you have not already)
  5. Copy the Measurement ID -- it looks like G-XXXXXXXXXX

Setting Up the Plugin

  1. Go to Admin Panel > Plugins
  2. Find Google Analytics and click Enable if it is not already enabled
  3. Click the Settings button
  4. Enter your Measurement ID in the field provided
  5. Click Save
SettingWhat to Enter
Measurement IDYour GA4 Measurement ID (e.g., G-QWGCB9M166)

That is it. The tracking code will be injected into your storefront pages automatically.

Verifying It Works

After setting up the plugin:

  1. Open your storefront in a browser
  2. Go to your Google Analytics dashboard
  3. Click Reports > Realtime
  4. You should see your visit appear within a few seconds

TIP

If you do not see data in the Realtime report, wait a minute and refresh. Also make sure you have not enabled any ad blockers or privacy extensions that might block the GA4 script.

What Gets Tracked

With the plugin enabled, GA4 will automatically track:

  • Page views -- every page your customers visit
  • Session data -- how long visitors stay, bounce rate, etc.
  • Traffic sources -- where visitors come from (search, social, direct, etc.)
  • Geographic data -- visitor locations and languages
  • Device info -- desktop, mobile, tablet, browser type

For advanced tracking (like e-commerce events or custom conversions), you can configure those directly in your Google Analytics dashboard.

Shop Craft Documentation