如何在Google Analytics(分析)中查看Gtag建议的参数?

时间:2018-12-28 05:35:27

标签: google-analytics gtag.js

我正在使用网站中的gtag.js库,并在Google Analytics(分析)中查看结果。我已经实现了purchase事件,如下所示:

trackPurchase({ checkoutResult, order, items }) {
  const gtagItems = items.map(item => orderItemToGAItem(item));
  this.gtag('event', 'purchase', {
    transaction_id: checkoutResult.transactionId,
    value: checkoutResult.amount,
    currency: checkoutResult.currency,
    shipping: order.shippingCost,
    itmes: gtagItems,
  });
}

触发事件后,Chrome中的GA调试器会在控制台中显示以下内容:

Running command: ga("gtag_UA_********.send", "event", {currencyCode: "HKD", forceSSL: true, &gtm: "2oubc0", hitCallback: [function], eventCategory: "ecommerce", eventAction: "purchase", eventValue: 400})
analytics_debug.js:23 
Sent beacon:
[ ****** ]


analytics_debug.js:23 <unknown>        (&gtm)  2oubc0
analytics_debug.js:23 _j1              (&jid)  
analytics_debug.js:23 _j2              (&gjid) 
analytics_debug.js:23 adSenseId        (&a)    317378694
analytics_debug.js:23 apiVersion       (&v)    1
analytics_debug.js:23 clientId         (&cid)  [ ****** ]
analytics_debug.js:23 currencyCode     (&cu)   HKD
analytics_debug.js:23 ec:action        (&pa)   purchase
analytics_debug.js:23 ec:id            (&ti)   [ ****** ]
analytics_debug.js:23 ec:revenue       (&tr)   400
analytics_debug.js:23 ec:shipping      (&ts)   20
analytics_debug.js:23 encoding         (&de)   UTF-8
analytics_debug.js:23 eventAction      (&ea)   purchase
analytics_debug.js:23 eventCategory    (&ec)   ecommerce
analytics_debug.js:23 eventValue       (&ev)   400
analytics_debug.js:23 hitType          (&t)    event
analytics_debug.js:23 javaEnabled      (&je)   0
analytics_debug.js:23 language         (&ul)   en-us
analytics_debug.js:23 location         (&dl)   [ ****** ]
analytics_debug.js:23 screenColors     (&sd)   24-bit
analytics_debug.js:23 screenResolution (&sr)   2560x1440
analytics_debug.js:23 title            (&dt)   OrderInfo
analytics_debug.js:23 trackingId       (&tid)  [ ****** ]
analytics_debug.js:23 viewportSize     (&vp)   1643x928

我可以在Google Analytics(分析)控制台中看到事件purchase,但是没有label,并且找不到shippingvalue,{{1} },currencytransaction_id。如何根据这些值过滤事件或查看事件?

谢谢。

1 个答案:

答案 0 :(得分:0)

实际上,您不能在希望它们正确集成到Analytics(分析)中的事件参数中使用任何字段名称。您应该按照本节的规定尊重名称:https://developers.google.com/analytics/devguides/collection/gtagjs/migration#map_analyticsjs_fields_to_gtagjs_parameters

如果要设置标签,则要使用的字段名称为event_label,如下所示:

this.gtag('event', 'purchase', {
  'event_label': checkoutResult.transactionId
});