gtag Purchase Event ignored on Google Analytics

Viewed 3889

I'm succesfully tracking some events with gtag.js on Google Analytics, with the exception of "purchase" event. Using GTM/GA chrome plugin I've checked that all events are tracked correctly, "purchase" included. The problem is that "purchase" is not tracked on Google Analytics: all the others are tracked ("begin_checkout", "add_to_cart" ...).

gtag("event", "purchase", {
  affiliation: "Google online store",
  coupon: "SUMMER_DISCOUNT",
  currency: "USD",
  shipping: 5.55,
  tax: 3.33,
  transaction_id: "T_1",
  value: 28.86,
  items: [
    {
      id: "P12345",
      name: "Android Warhol T-Shirt",
      coupon: "P12345_coupon",
      list_name: "Search Results",
      brand: "Google",
      category: "Apparel/T-Shirts",
      variant: "Black",
      list_position: 3,
      quantity: 1,
      price: 9.99
    },
    {
      id: "P12346",
      name: "Flame challenge TShirt",
      coupon: "P12346_coupon",
      list_name: "Search Results",
      brand: "MyBrand",
      category: "Apparel/T-Shirts",
      variant: "Red",
      list_position: 5,
      quantity: 1,
      price: 9.99
    }
  ]
});

The conversion/e-commerce graph is flat as you can see. What am I missing? enter image description here

Update I've created a GAnalytics test account and the purchase event is tracked. On the screenshot's account, maybe, some configuration is missing: could be?

3 Answers

I had the exact same problem. Some things I noticed that could explain ut.

  1. Date Range: Maybe you missed the fact that the date range in your Analytics report is set for 26 Oct - 1 Nov, while your events were triggered on 2 Nov?

  2. Wrong Value Field: If the calculation of the value field is wrong (does not equal total of all items plus shipping field plus tax field) Google might ignore the event.

  3. Processing Time: Even when the "Real-Time" view shows the events, they are not always included in other reports until some time later.

Interestingly I'm seeing something similar on my tests and I'm using some sample code off google:

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXX-Y"></script>
<script nonce="djRFUUKP+SLF1k4qkKFqiLTO4Qo=">
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments); }
    gtag('js', new Date());
    gtag('config', 'UA-XXXXXX-Y');
    </script>

    <script nonce="djRFUUKP+SLF1k4qkKFqiLTO4Qo=">
    gtag('event', 'purchase', {
    "transaction_id": "24.031608523954162_C",
    "affiliation": "Google online store_C",
    "value": 0.01,
    "currency": "GBP",
    "tax": 1.24,
    "shipping": 0,
    "items": [
    {
      "id": "P12345C",
      "name": "Android Warhol T-Shirt",
      "list_name": "Search Results",
      "brand": "Google",
      "category": "Apparel/T-Shirts",
      "variant": "Black",
      "list_position": 1,
      "quantity": 2,
      "price": '0.01'
    },
    {
      "id": "P67890C",
      "name": "Flame challenge TShirt",
      "list_name": "Search Results",
      "brand": "MyBrand",
      "category": "Apparel/T-Shirts",
      "variant": "Red",
      "list_position": 2,
      "quantity": 1,
      "price": '3.0'
    }
    ]
    });
    </script>

We use nonce because we are using CSP and believe all CSP urls are set correctly in the CSP.

Any insight would be a great help as to why this would not be logging this transaction data.

Related