【问题标题】:Google Analytics eCommerce Tracking snippetGoogle Analytics 电子商务跟踪代码段
【发布时间】:2014-01-30 03:51:09
【问题描述】:

我正在尝试使用谷歌分析电子商务跟踪来跟踪电子商务交易...

<?php
$tx_token = '234234234';
$amount = '19.99';
?>

<script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-12345678-1']);
  _gaq.push(['_trackPageview']);

  _gaq.push(['_addTrans',
    '<?php echo $tx_token; ?>',  // Transaction ID
    'My Store',             // Affiliation or store name
    '<?php echo $amount; ?>',    // Total
  ]);

  _gaq.push(['_addItem',
    'D1D44',
    'My Item',
    'Category / Variation',
    '<?php echo $amount; ?>',
    '1'
  ]);

  _gaq.push(['_trackTrans']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

这应该足够了吗?我需要 addItem 和 addTrans 中的 $tx_token 值吗?

【问题讨论】:

    标签: google-analytics e-commerce


    【解决方案1】:

    是的,您需要交易中每件商品的交易 ID(Google Analytics(分析)就是这样判断这些商品属于某笔交易的)。因此,事务 id 是每个 addItem 调用所需的第一个参数。实际上,GA 文档 (Ecommerce Tracking with ga.js) 对此进行了非常详尽的描述。

    【讨论】:

      猜你喜欢
      • 2014-09-17
      • 2011-08-01
      • 2013-01-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-11
      • 2012-01-24
      • 1970-01-01
      相关资源
      最近更新 更多