Documentation Menu

Google analytics 4 documentation

GA4 Banner

PRE-REQUISITES

  • The plugin requires you to install the Nop-Station Core plugin first.

INSTALLATION

  • Download the Google Analytics 4 plugin from our store: https://nop-station.com/customer/downloadableproducts
  • Go to the Administration section of your site.
  • Then go to Configurations > Local Plugins.
  • Find and click on the 'Upload plugin or theme' button on the top right.

    local-plugins-page

  • Select the NopStation.Plugin.Widgets.GoogleAnalytics.zip file.

    select-plugin-or-theme

  • Upload the file using the 'Upload plugin or theme' button.
  • After uploading the plugin go to Administration. Install the 'Nop-Station Core' plugin first and then install the 'Google Analytics 4' plugin.

    install-nop-station-core

    install-ga4-plugin

  • Restart the application.

CONFIGURATION

  • Go to Configurations > Local Plugins.
  • Search or scroll down to find the Google Analytics 4 plugin.
  • Click the Edit button in the plugin info section.
  • Click the Enabled checkbox to enable the plugin

GOOGLE ANALYTICS 4 SETUP

  • Create a Google Analytics account and follow the wizard to add your website.
  • Copy the Tracking ID from Google Analytics into the ID field of the plugin configuration.

    ga4-tracking-id

  • In Google Analytics, click on the Measurement Protocol API secrets under Events.

    ga4-measurement-protocol-view

Click on Create button and follow the instructions to create a new API secret.

ga4-api-secret

Use Sandbox

This setting determines whether the Measurement Protocol API sends data to the validation (debug) server or the production server.

  •  When enabled, the plugin uses the debug endpoint:
  •  When disabled, the plugin uses the production endpoint.

Google ID (Measurement ID)

This is the GA4 Measurement ID used to connect your store with Google Analytics.

Format:
 G-XXXXXXXXXX

You can find it in Google Analytics under:
 Admin → Data Streams → Select your stream → Measurement ID

The Measurement ID is required for both:

  • JavaScript tracking (gtag.js)
  • Server-side Measurement Protocol API requests

Tracking will not function correctly without a valid Measurement ID.

API Secret

The API Secret is used to authenticate Measurement Protocol API requests.

It can be generated in Google Analytics under:
Admin → Data Streams → Measurement Protocol API Secrets

The API Secret is used only for server-side (API-based) tracking.

Tracking Script

This section contains the standard GA4 gtag.js tracking template injected into store pages.

<!-- Global site tag (gtag.js) - Nopstation Google Analytics -->

<script async src='https://www.googletagmanager.com/gtag/js?id={GOOGLEID}'></script>

<script>

  window.dataLayer = window.dataLayer || [];

  function gtag(){dataLayer.push(arguments);}

  gtag('js', new Date());

 

  gtag('config', '{GOOGLEID}', {

    'cookie_prefix': 'nopstation'

});

   

  gtag('config', '{GOOGLEID}');

  {CUSTOMER_TRACKING}

  {ECOMMERCE_TRACKING}

</script>

This template should not be modified manually.

 

Enable eCommerce

This is the master switch for eCommerce tracking.

When enabled, the plugin tracks purchase events, order items, revenue, and related transactional data. (Recommended)

When disabled, no eCommerce data is sent to Google Analytics.

If enabled, you must choose how eCommerce data will be transmitted:

  • JavaScript-based (client-side)
  • API-based (server-side via Measurement Protocol)

 

Use JS to Send eCommerce Info

This setting controls how e‑commerce events are sent to Google Analytics 4 (GA4).

When enabled, both JavaScript and API-based tracking are used:

  • When an order is completed, JavaScript sends the purchase event to GA4
  • When the order is marked as paid API sends the purchase event

When disabled, only the Measurement Protocol API is used:

  • JavaScript does not send purchase events.
  • The purchase event is sent via API when the order is marked as paid.

This mode requires a properly configured API Secret. The recommendation is to keep this setting disabled if you want more reliable tracking unaffected by browser behavior, ad blockers, or consent dialogs.

 

Include Tax

This setting controls whether tax is included in price calculations for eCommerce events.

Include Customer ID

This setting determines whether the customer identifier is included in tracking.

This applies only to registered customers. Guest users are not affected.

 

Save Log

This setting controls whether Measurement Protocol API activity is logged in the system log.

Logging is recommended during initial setup and debugging. It should be disabled in production environments to prevent excessive log growth.

 

 

 

Book a Meeting