【问题标题】:Google Analytics Ecommerce Tracking Not Working As Expected with PayPalGoogle Analytics(分析)电子商务跟踪无法与 PayPal 一起按预期工作
【发布时间】:2013-06-15 14:40:17
【问题描述】:

每当客户通过 PayPal 从我的网站购买产品时,我都会将他重定向回下载该产品。

我想在 Analytics 中推送该交易,但它没有按预期工作。

PayPal 使用几个 $_GET 变量将他重定向回来:交易 ID (tx)、支付金额 (amt)。

 var _gaq = _gaq || [];
 _gaq.push(['_setAccount', '[MY_CODE_HERE]']);
 _gaq.push(['_setAllowLinker', true]);
 _gaq.push(['_trackPageview']);

 _gaq.push(['_addTrans',
 '<?php echo $_GET['tx']; ?>',                         // transaction ID - required
 '<?php echo $_GET['amt']; ?>',                        // total - required
 '0',                                                  // tax
 '0'                                                   // shipping
 ]);
 _gaq.push(['_addItem',
 '<?php echo $_GET['tx']; ?>',                         // transaction ID - required
 'SKU here',                                           // SKU/code - required
 'Product here',                                       // product name
 '<?php echo $_GET['amt']; ?>',                        // unit price - required
 '1'                                                   // quantity - required
 ]);
 _gaq.push(['_trackTrans']);

 (function() {
 // the remaining here.
 })();

$_GET['tx']$_GET['amt'] 工作正常,但交易未显示在 Analytics 中。

配置文件设置为电子商务网站。我可以查看来自不同支付处理器 FastSpring 的交易。

来自 PayPal 的交易根本不会出现在 Analytics 中。

【问题讨论】:

    标签: paypal google-analytics e-commerce


    【解决方案1】:

    _addTrans_addItem 必须具有所有设置,包括那些仅带有 '' 的可选设置。

     _gaq.push(['_addTrans',
     '<?php echo $_GET['tx']; ?>',                         // transaction ID - required
     '',                                                   // affiliation or store name
     '<?php echo $_GET['amt']; ?>',                        // total - required
     '0',                                                  // tax
     '0',                                                  // shipping
     '',                                                   // city
     '',                                                   // state or province
     ''                                                    // country
     ]);
     _gaq.push(['_addItem',
     '<?php echo $_GET['tx']; ?>',                         // transaction ID - required
     'SKU here',                                           // SKU/code - required
     'Product here',                                       // product name
     '',                                                   // category or variation
     '<?php echo $_GET['amt']; ?>',                        // unit price - required
     '1'                                                   // quantity - required
     ]);
    

    我建议使用 Chrome 扩展程序 GA Debug 进行调试。

    【讨论】:

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