Step 2: Complete the Commerce configuration

  1. Log in to the Admin for your Commerce store.

  2. On the Admin sidebar, go to Stores > Settings > Configuration.

  3. In the left panel, expand Sales and choose Google API.

  4. Expand Expansion selector the Google GTag section.

  5. Expand Expansion selector the Google Analytics4 subsection and do the following:

    • Set Enable to Yes.

    • Leave the Account type as Google Analytics4.

    • Enter your Measurement ID. To learn more, see Google Analytics Help.

    • If you want to conduct A/B testing and other performance tests on your content, set Content Experiments to Yes.

    Sales configuration - Google API for Google Analytics 4

  6. When complete, click Save Config.

Google Universal Analytics

IMPORTANT
On July 1, 2023, standard Universal Analytics properties will no longer process data. If you still rely on Universal Analytics, it is recommended that you prepare to use Google Analytics 4 going forward.

Step 1: Set up Google Universal Analytics

Visit the Google website, and sign up for a Google Universal Analytics account.

Step 2: Complete the Commerce configuration

  1. Log in to the Admin for your Commerce store.

  2. On the Admin sidebar, go to Stores > Settings > Configuration.

  3. In the left panel, expand Sales and choose Google API.

  4. Expand Expansion selector the Google Analytics section and do the following:

    • Set Enable to Yes.

    • Enter your Google Analytics Account Number.

    • If you want to conduct A/B testing and other performance tests on your content, set Content Experiments to Yes.

    Sales configuration - Google API - Google Analytics

  5. When complete, click Save Config.

Enhanced Ecommerce

Enhanced Ecommerce is a plugin for Google Universal Analytics that gives you insight into the shopping and purchasing behavior of your customers. You can use Enhanced Ecommerce to produce reports about key customer activities, such as when customers add items the cart, begin the checkout process, or complete a purchase. You can also identify and analyze patterns of shoppers who abandon their carts without making a purchase.

The following instructions show how to configure Google Tag Manager with Universal Analytics to produce Enhanced Ecommerce data and reports.

Step 1. Sign up for Google accounts

  1. Sign up for a Google Tag Manager account, and complete the Commerce configuration.

  2. Sign up for a new Google Universal Analytics account.

Step 2. Configure Enhanced Ecommerce

  1. Sign in to your Google Universal Analytics account.

  2. Create a property for Enhanced Ecommerce analytics with the following settings:

    • Status: ON
    • Related Products: ON
    • Enable Enhanced Ecommerce Reporting: ON
    • Checkout Labeling: (not required)
  3. When complete, click Submit.

Step 3. Create tags and triggers

  1. Sign in to your Google Tag Manager account and create the following triggers:

    NameEvent TypeFilter
    addToCartCustom Event
    checkoutCustom Event
    checkout onlyPage ViewPage URL matches RegEx /checkout/.*
    checkoutOptionCustom Event
    gtm.domCustom Event
    productClickCustom Event
    promotionClickCustom Event
    removeFromCartCustom Event
    NOTE
    The Checkout event is triggered for the built-in Commerce basic payment methods only (such as Check / Money Order and Cash On Delivery Payment). This event is not executed for PayPal checkout and other external payment methods, which use redirection to the checkout from external resources.
  2. Create the following Universal Analytics tags with the same basic configuration.

    • Universal Analytics Tags

      NameTypeFiring triggers
      Add to cart trackingUniversal AnalyticsaddToCart
      Checkout option trackingUniversal AnalyticscheckoutOption
      Checkout trackingUniversal Analyticscheckout
      Pageview trackingUniversal Analyticsgtm.dom
      Product click trackingUniversal AnalyticsproductClick
      Promo click trackingUniversal AnalyticspromotionClick
      Remove from cart trackingUniversal AnalyticsremoveFromCart
    • Basic Tag Configuration

      SettingValue
      ProductGoogle Analytics
      Tag TypeUniversal Analytics
      Tracking IDUA-XXX (The tracking ID from your Universal Analytics account.)
      Enable Enhanced Ecommerce FeaturesTrue
      Use data layerTrue
      Use Debug versionTrue
  3. Complete the individual tracking configurations.

    • Enter the following Add to Cart tracking settings:

      SettingValue
      Track TypeEvent
      CategoryEcommerce
      ActionAdd to Cart
      TriggeraddToCart
    • Enter the following Checkout option tracking settings:

      SettingValue
      Track TypeEvent
      CategoryEcommerce
      ActionCheckout Option
      TriggercheckoutOption
    • Enter the following PageView tracking settings:

      SettingValue
      Track TypePageView
      Triggergtm.dom
    • Complete the following Product Click tracking configuration:

      SettingValue
      Track TypeEvent
      CategoryEcommerce
      ActionProduct Click
      TriggerproductClick
    • Complete the following Promotion Click tracking configuration:

      SettingValue
      Track TypeEvent
      CategoryEcommerce
      ActionPromotion Click
      TriggerpromotionClick
    • Complete the following Remove from Cart tracking configuration:

      SettingValue
      Track TypeEvent
      CategoryEcommerce
      ActionRemove from Cart
      TriggerremoveFromCart
  4. When complete, click Preview and verify that the tags work correctly.

  5. After verifying the settings, click Publish.

Next pageGoogle Tag Manager

Commerce