• Hi!
    I am also throwing my hat into the ring and ask for help. Google Analytics eCommerce Tracking broke after the ~6th of October on three different sites. They all have the same setup.

    I suspect this has to do with a WP / WooCommerce update or Google Analytics / GTM changed how they want the data layer to look like. I am not aware that GTM4WP was updated.

    I have set up everything in WordPress, GTM and GA according to this guide:
    https://gtm4wp.com/how-to-articles/how-to-setup-enhanced-ecommerce-tracking

    To comply with GDPR, I used Trigger Groups, combining the triggers from the guide with the Borlabs Opt-In Triggers: https://borlabs.io/kb/google-tag-manager/#ch_3 However, I removed them to debug. They are not the issue.

    But I am having the problem that the gtm4wp.orderCompletedEEC GA3 event does not contain any ecom purchase data – and therefore no transaction is created in GA3.

    My trigger: https://imgur.com/VZadCQJ
    My tag: https://imgur.com/s7TAZCu
    Datalayer for gtm4wp.orderCompletedEEC event:

    {
      event: "gtm4wp.orderCompletedEEC",
      gtm: {uniqueEventId: 13},
      visitorLoginState: "logged-in",
      visitorType: "administrator",
      pagePostType: "page",
      pagePostType2: "single-page",
      pagePostAuthor: "adminTZN",
      customerTotalOrders: 1,
      customerTotalOrderValue: "0.00",
      customerFirstName: "Franz",
      customerLastName: "Sauerstein",
      customerBillingFirstName: "Franz",
      customerBillingLastName: "Sauerstein",
      customerBillingCompany: "",
      customerBillingAddress1: "Musterstra?e 123",
      customerBillingAddress2: "",
      customerBillingCity: "Musterstadt",
      customerBillingPostcode: "12345",
      customerBillingCountry: "DE",
      customerBillingEmail: "[email protected]",
      customerBillingPhone: "004917663089857",
      customerShippingFirstName: "Franz",
      customerShippingLastName: "Sauerstein",
      customerShippingCompany: "",
      customerShippingAddress1: "Musterstra?e 123",
      customerShippingAddress2: "",
      customerShippingCity: "Musterstadt",
      customerShippingPostcode: "12345",
      customerShippingCountry: "DE",
      cartContent: {
        totals: {
          applied_coupons: [],
          discount_total: 0,
          subtotal: 0,
          total: 0
        },
        items: []
      },
      orderData: {
        attributes: {
          date: "2021-10-19T09:47:02+00:00",
          order_number: "47588",
          order_key: "wc_order_8xJ0AdUIBPI3L",
          payment_method: "",
          payment_method_title: "",
          shipping_method: "Versandkostenfrei",
          status: "processing",
          coupons: "testing100"
        },
        totals: {
          currency: "EUR",
          discount_total: "23.81",
          discount_tax: "1.6667",
          shipping_total: "0",
          shipping_tax: "0",
          cart_tax: "-0.000434",
          total: "0.00",
          total_tax: "0",
          total_discount: "23.81",
          subtotal: "23.8",
          tax_totals: {
            DE-MWST. DE REDUZIERTER-PREIS-1: {
              amount: -0.000434,
              id: 23088,
              rate_id: 34,
              is_compound: false,
              label: "MwSt. DE reduzierter-preis",
              formatted_amount: "<span class=\"woocommerce-Price-amount a" +
                                "mount\"><bdi>-0,00<span class=\"woocomme" +
                                "rce-Price-currencySymbol\">&euro;</span>" +
                                "</bdi></span>"
            }
          }
        },
        customer: {
          id: 7779,
          billing: {
            first_name: "Franz",
            last_name: "Sauerstein",
            company: "",
            address_1: "Musterstra?e 123",
            address_2: "",
            city: "Musterstadt",
            state: "",
            postcode: "12345",
            country: "DE",
            email: "[email protected]",
            phone: "004917663089857"
          },
          shipping: {
            first_name: "Franz",
            last_name: "Sauerstein",
            company: "",
            address_1: "Musterstra?e 123",
            address_2: "",
            city: "Musterstadt",
            state: "",
            postcode: "12345",
            country: "DE"
          }
        },
        items: [
          {
            id: "2512",
            name: "Luxus-Nuss Bruchschokolade",
            sku: "2512",
            category: "Bruchschokolade",
            price: 0,
            stocklevel: 10,
            quantity: 1
          },
          {
            id: "2109",
            name: "Schokotafel Vollmilch Cappuccino",
            sku: "2109",
            category: "Vollmilchschokolade",
            price: 0,
            stocklevel: 0,
            quantity: 1
          },
          {
            id: "4050",
            name: "Schoko-Teddy gro? -personalisierbar-",
            sku: "4050",
            category: "personalisierte Schokolade",
            price: 0,
            stocklevel: -1,
            quantity: 1
          }
        ]
      },
      ecommerce: {
        currencyCode: "EUR",
        purchase: {
          actionField: {
            id: "47588",
            affiliation: "",
            revenue: 0,
            tax: 0,
            shipping: 0,
            coupon: "testing100"
          },
          products: [
            {
              id: "2512",
              name: "Luxus-Nuss Bruchschokolade",
              sku: "2512",
              category: "Bruchschokolade",
              price: 0,
              stocklevel: 10,
              quantity: 1
            },
            {
              id: "2109",
              name: "Schokotafel Vollmilch Cappuccino",
              sku: "2109",
              category: "Vollmilchschokolade",
              price: 0,
              stocklevel: 0,
              quantity: 1
            },
            {
              id: "4050",
              name: "Schoko-Teddy gro? -personalisierbar-",
              sku: "4050",
              category: "personalisierte Schokolade",
              price: 0,
              stocklevel: -1,
              quantity: 1
            }
          ]
        }
      }
    }

    The GA3 tag is firing upon the gtm4wp.orderCompletedEEC event: https://imgur.com/6XLkuf1
    I am seeing the events in Google Analytics, but not the revenue in eCommerce Tracking: https://imgur.com/0uEUiQE

    The page: https://bengelmann.com/
    GA debug link: https://tagassistant.google.com/#/?id=GTM-5LKBH46&url=https%3A%2F%2Fbengelmann.com%2F%3Fgtm_debug%3D1634628391828&source=TAG_MANAGER&gtm_auth=gUj-2FB3AFryFUDDQMFk8A&gtm_preview=env-46

    How to place an order without paying: Use email adress [email protected], PW %@j6t*sddNC5wbHPPyehhlgs and coupon code TESTING100.

    I currently run Google Analytics WooCommerce Tracking in parallel, because I need to track orders.

    Thank you for taking a look!

    The page I need help with: [log in to see the link]

Viewing 8 replies - 16 through 23 (of 23 total)
  • Thread Starter Franz92

    (@franz92)

    Plugin Author Thomas Geiger

    (@duracelltomi)

    Thanks, I placed another order and now the transaction was there.

    In your tag setup you are using the GTM variable template of Borlabs to read the consent state. That is dependent on whether Borlabs’ JavaScript codes are loaded or not. I can see here a race condition that could impact your tracking.

    What we could do is to test if we read the Borlabs consent cookie directly, does this give better data collection quality? If yes, I could contact them to propose a change in their variable template.

    Thread Starter Franz92

    (@franz92)

    Hi Thomas,
    great to find the culprit, thanks! Gladly – they will be more than happy to find ways to make their plugin better.

    Thread Starter Franz92

    (@franz92)

    Hi Thomas,
    I just re-read your answer and understand that I did misread it.

    What we could do is to test if we read the Borlabs consent cookie directly, does this give better data collection quality?

    How would I do that?

    Best,
    Franz

    Plugin Author Thomas Geiger

    (@duracelltomi)

    Use a 1st party cookie variable in GTM to read the cookie named borlabs-cookie.

    It will be a JSON string:

    {
        "consents": {
            "essential": ["borlabs-cookie", "google-tag-manager", "woocommerce"]
        },
        "domainPath": "bengelmann.com/",
        "expires": "Thu, 23 Feb 2023 15:33:54 GMT",
        "uid": "___redacted___",
        "version": "4"
    }

    or:

    {
        "consents": {
            "essential": ["borlabs-cookie", "google-tag-manager", "woocommerce"],
            "statistics": ["google-analytics", "hotjar"],
            "marketing": ["facebook-pixel"]
        },
        "domainPath": "bengelmann.com/",
        "expires": "Thu, 23 Feb 2023 15:35:26 GMT",
        "uid": "___redacted___",
        "version": "4"
    }

    Now you can use for example a custom JS variable to check whether specific consent has been given:

    (assuming your 1st party cookie variable name is Borlabs Cookie Value)

    function() {
      var c = {{Borlabs Cookie Value}};
    
      try {
        var consent_status = JSON.parse(c);
        if ( consent_status.consents && consent_status.consents.statistics ) {
          return consent_status.consents.statistics.includes( "google-analytics" );
        }
      } except {
        //something went wrong with JSON decode, perhaps cookie is empty or undefined
      }
    
      return undefined; // could be also false
    }

    Name this GTM variable like “Google Analytics Consent Status” and use it as a trigger rule condition instead of a separate trigger.

    Thread Starter Franz92

    (@franz92)

    Hi,
    thank you!

    Quick note: You’ll have to use “catch (err)” instead of “except” in the second code sample:

    function() {
      var c = {{Borlabs Cookie Value}};
    
      try {
        var consent_status = JSON.parse(c);
        if ( consent_status.consents && consent_status.consents.statistics ) {
          return consent_status.consents.statistics.includes( "google-analytics" );
        }
      } catch (err) {
        //something went wrong with JSON decode, perhaps cookie is empty or undefined
      }
    
      return undefined; // could be also false
    }

    So, using this my return for the 1st party cookie variable is:

    "%7B%22consents%22%3A%7B%22essential%22%3A%5B%22borlabs-cookie%22%2C%" +
    "22google-tag-manager%22%2C%22woocommerce%22%5D%2C%22statistics%22%3A" +
    "%5B%22google-analytics%22%2C%22hotjar%22%5D%2C%22marketing%22%3A%5B%" +
    "22facebook-pixel%22%5D%7D%2C%22domainPath%22%3A%22bengelmann.com%2F%" +
    "22%2C%22expires%22%3A%22Tue%2C%2003%20Jan%202023%2013%3A48%3A07%20GM" +
    "T%22%2C%22uid%22%3A%225v5lah1s-rw2adhk8-2by5uhr6-4jyj5n8f%22%2C%22ve" +
    "rsion%22%3A%224%22%7D"

    Whereas I get ‘undefined’ for “Google Analytics Consent Status” upon the orderComplete event.

    That surprises me. The consent for google-analytics seems to be given, so the return value shouldn’t be undefined.

    I used this to debug.

    Plugin Author Thomas Geiger

    (@duracelltomi)

    Hi,

    Quick note: You’ll have to use “catch (err)” instead of “except” in the second code sample:

    Yeah, sorry, silly me ??

    Whereas I get ‘undefined’ for “Google Analytics Consent Status” upon the orderComplete event.

    Could you turn on the checkbox in the 1st party cookie variable that says “URI-decode cookie”?

    Thread Starter Franz92

    (@franz92)

    Hi!
    My return for the 1st party cookie variable upon the orderComplete event is:

    "{\"consents\":{\"essential\":[\"borlabs-cookie\",\"google-tag-manage" +
    "r\",\"woocommerce\"],\"statistics\":[\"google-analytics\",\"hotjar\"" +
    "],\"marketing\":[\"facebook-pixel\",\"klaviyo\"]},\"domainPath\":\"b" +
    "engelmann.com/\",\"expires\":\"Tue, 04 Apr 2023 13:34:37 GMT\",\"uid" +
    "\":\"xftc0mgc-xg1rydxy-mrco30ac-rgzb7yd1\",\"version\":\"4\"}"

    For “Google Analytics Consent Status” upon the orderComplete event it is

    true

    I’ve used this for testing.

    > What we could do is to test if we read the Borlabs consent cookie directly, does this give better data collection quality? If yes, I could contact them to propose a change in their variable template.

    Does that help?

    Coverage seems to be a lot better. It was 29% before, 51% now. (Still lower than what I am seeing on other sites, but a least better.)

Viewing 8 replies - 16 through 23 (of 23 total)
  • The topic ‘Google Analytics 3 Revenue Tracking broke’ is closed to new replies.