gtag事件购买货币被忽略,始终为美元

时间:2019-04-10 10:11:38

标签: google-analytics gtag.js

在我的电子商务中进行购买时,会触发类型为“购买”的事件,并且该事件会正确显示在Google Analytics(分析)信息中心上(货币除外)。

我遵循了这个guide,但也尝试传递带有'transaction'前缀的参数(例如'transactionCurrency'而不是'currency')。但我看不出有什么区别。

这是我如何为事件生成有效负载以及如何发送

var payload = {
   "transaction_id": tid,                    
   'value': 999.99,                    
   'currency': "EUR", //<--this will be ignored
   'items': items.map(item => ({
       sku: item.sku,
       name: item.description,
       price: item.price,
       quantity: item.qty                        
    }))
};
gtag("event", "purchase", payload)

以下是发送请求的示例:

https://www.google-analytics.com/collect?v=1&_v=j73&a=1550934340&t=event&cu=EUR&_s=2&dl=http%3A%2F%2Fmyhost.svi%2Fordini&ul=it-it&de=UTF-8&dt=ORDINI&sd=24-bit&sr=1920x1080&vp=1912x462&je=0&ec=ecommerce&ea=purchase&ev=45&_u=SCCAAUAL~&jid=&gjid=&cid=252314052.1551781012&tid=UA-xxxxxxxx-x&_gid=xxxxxx.xxxxx&gtm=2ou430&ti=C19000000021&tr=45.19&tt=8.15&ts=5&pa=purchase&pr1nm=item1&pr1pr=1.49&pr1qt=2&pr2nm=item2&pr2pr=21.85&pr2qt=2&z=1998964134

为便于阅读,查询字符串参数为:

{
    "v": "1",
    "_v": "j73",
    "a": "1550934340",
    "t": "event",
    "cu": "EUR",
    "_s": "2",
    "dl": "http%3A%2F%2Fmyhost.svi%2Fordini",
    "ul": "it-it",
    "de": "UTF-8",
    "dt": "ORDINI",
    "sd": "24-bit",
    "sr": "1920x1080",
    "vp": "1912x462",
    "je": "0",
    "ec": "ecommerce",
    "ea": "purchase",
    "ev": "45",
    "_u": "SCCAAUAL~",
    "jid": null,
    "gjid": null,
    "cid": "252314052.1551781012",
    "tid": "UA-xxxxxxxx-x",
    "_gid": "xxxxxx.xxxxx",
    "gtm": "2ou430",
    "ti": "C19000000021",
    "tr": "45.19",
    "tt": "8.15",
    "ts": "5",
    "pa": "purchase",
    "pr1nm": "item1",
    "pr1pr": "1.49",
    "pr1qt": "2",
    "pr2nm": "item2",
    "pr2pr": "21.85",
    "pr2qt": "2",
    "z": "1998964134"
}

货币应为EUR,但这是结果:

screenshot

2 个答案:

答案 0 :(得分:0)

在GA的管理员中更改ga视图的设置,以欧元(而非美元)收集电子商务数据。 如果您在网站上使用一种货币,那么您甚至不需要在gtag中设置欧元货币。

https://support.google.com/analytics/answer/1010249?hl=en

答案 1 :(得分:0)

正如@Yoray所述,在视图设置中更改货币设置,这应该可以解决。

为此,如果您在匹配中指定了一种货币,则您可能会在自定义报告中将其视为“本地货币”。 (我尚未通过gtag.js对此进行确认)。