使用电子商务扩展时是否可以将自定义变量发送到 Google 分析

is it possible to send custom variables to Google analytics while using ecommerce extension

所以基本上我试图在使用电子商务扩展时通过 google 分析面板获取自定义变量。我的主要目标是为每个项目提供一组自定义值。

我的 "code" 看起来像这样:

ga('require', 'ecommerce');
ga('ecommerce:addTransaction', {
    'id': 'id',                     
    'affiliation': 'affiliation',  
});
ga('ecommerce:addItem', {
    'id': 'id',
    'name': 'Loan  - name',
    'sku': '{RIDA:success_loan_id}',
    'loanSumEur': 'Sum',
    'loanSumLit': 'Sum LTL',
    'loanLength': 'length',
    'loanData': 'data'
});
ga('ecommerce:send');
ga('ecommerce:clear');

我应该如何声明这些 loanSumEur、loanSumLit、loanlength、loanData 变量,以便 Google 将它们传递给 google 分析管理面板。有可能吗?

为站点跟踪声明自定义变量非常容易,但是我在尝试对交易项目做同样的事情时遇到了一点困难。

BR

是的,可以使用自定义维度和指标。

ga('ec:addProduct', {               // Provide product details in an productFieldObject.
  'id': 'P12345',                   // Product ID (string).
  'name': 'Powerup',                // Product name (string).
  'category': 'Extras',             // Product category (string).
  'variant': 'red',                 // Product variant (string).
  'price': '10.00',                 // Product price (currency).
  'quantity': 2,                    // Product quantity (number).
  'dimension4': 'strong',           // Product-scoped custom dimension (string).
  'metric2': 5                      // Product-scoped custom metric (integer).
});
ga('ec:setAction', 'purchase', {
  'id': 'T12345',
  'revenue': '20.00'
});

ga('send', 'pageview');     // Send transaction data with initial pageview.

参见:Custom Dimensions & Metrics - Product-level scope