使用Google Analytics的增强型电子商务跟踪产品

时间:2016-07-06 10:48:09

标签: google-analytics e-commerce tracking enhanced-ecommerce

我使用此网址实现了Google Analytics与多个跟踪器:https://developers.google.com/analytics/devguides/collection/analyticsjs/creating-trackers#working_with_multiple_trackers 然后尝试在其中实施增强型电子商务,但未跟踪产品类别。在分析面板中,它显示(未设置)。我不知道自己出错了,因为我不是SEO专家。

在标题中:

<script>
//Google Analytics
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-123', 'auto');
  ga('create', 'UA-456', 'auto', 'abc');
  ga('create', 'UA-789', 'auto', 'xyz');

//Ecommerce tracking code
  ga("require", "ec", "ec.js");
//Ecommerce tracking code
</script>

在产品详情中,可以查看所有相同类别的产品

  <script type="text/javascript">
  ga('ec:addImpression', {
  'id': '<?php echo $sku_idx; ?>',                   // Product details are provided in an impressionFieldObject.
  'name': '<?php echo $curr_product['disp_name'];?>',
  'category': '<?php echo check_product_brand($curr_product['category'],$curr_product['L2']).'/'.ucfirst($curr_product['category']);?>',
  'brand': '<?php echo $curr_product['style'];?>',
  'variant': '<?php echo  $attr_code?>',
  'list': 'Product Listing',
  //'position': 1                     // 'position' indicates the product position in the list.
  });

最后

<script type="text/javascript">
ga('send', 'pageview');
ga('abc.send', 'pageview');
ga('xyz.send', 'pageview');

这是控制台:

Initializing Google Analytics.
Loading resource for plugin: ec
Loading script: "https://www.google-analytics.com/plugins/ua/ec.js"
Running command: ga("create", "UA-123", "auto")
Creating new tracker: t0
Auto cookieDomain found: "mytest.com"
Running command: ga("create", "UA-456", "auto", "abc")
Creating new tracker: dieselitaly
Auto cookieDomain found: "mytest.com"
Running command: ga("create", "UA-789", "auto", "xyz")
Creating new tracker: syg
Auto cookieDomain found: "mytest.com"

Running command: ga("require", "ec", "ec.js")
Waiting on require of "ec" to be fulfilled.
Registered new plugin: ga(provide, "render", Function)
Running command: ga("require", "ec", "ec.js")
Waiting on require of "ec" to be fulfilled.
Executing Google Analytics commands.
Running command: ga("require", "ec", "ec.js")
Waiting on require of "ec" to be fulfilled.
Executing Google Analytics commands.
Running command: ga("require", "ec", "ec.js")
Waiting on require of "ec" to be fulfilled.
Executing Google Analytics commands.
Running command: ga("require", "ec", "ec.js")
Waiting on require of "ec" to be fulfilled.
Executing Google Analytics commands.
Running command: ga("require", "ec", "ec.js")
Waiting on require of "ec" to be fulfilled.
Executing Google Analytics commands.
Running command: ga("require", "ec", "ec.js")
Waiting on require of "ec" to be fulfilled.
Executing Google Analytics commands.
Running command: ga("require", "ec", "ec.js")
Waiting on require of "ec" to be fulfilled.
Executing Google Analytics commands.
Registered new plugin: ga(provide, "ec", Function)
Running command: ga("require", "ec", "ec.js")
Plugin "ec" intialized on tracker "t0".
Running command: ga("ec:addImpression", {id: "98263", name: "Ab - Jacket", category: "Apparel/Men/Jackets", brand: "123456", variant: "900", list: "Product Listing"})
Running command: ga("ec:addImpression", {id: "98263", name: "Ab - Jacket", category: "Apparel/Men/Jackets", brand: "123456", variant: "900", list: "Product Listing"})

Executing Google Analytics commands.
Running command: ga("send", "pageview")

Sent beacon:
          v=1&_v=j44d&a=1234658035&t=pageview&_s=1&dl=https%3A%2F%2Fmytest.com%2Fproduct%2Fmens%2Fjackets&ul=en-us&de=UTF-/...... some stuff here

_j1                                          (&jid)       
adSenseId                                    (&a)         1234658035
apiVersion                                   (&v)         1
clientId                                     (&cid)       819866210.1464779007
ec:impression list "1" name                  (&il1nm)     Product Listing
ec:impression list "1" product "1" brand     (&il1pi1br)  123456
ec:impression list "1" product "1" category  (&il1pi1ca)  Apparel/Men/Jackets
ec:impression list "1" product "1" id        (&il1pi1id)  98263
ec:impression list "1" product "1" name      (&il1pi1nm)  Ab - Jacket
ec:impression list "1" product "1" variant   (&il1pi1va)  900
encoding                                     (&de)        UTF-8
flashVersion                                 (&fl)        22.0 r0
hitType                                      (&t)         pageview
javaEnabled                                  (&je)        0
language                                     (&ul)        en-us
location                                     (&dl)        https://mytest.com/product/mens/jackets
screenColors                                 (&sd)        24-bit
screenResolution                             (&sr)        1366x768
title                                        (&dt)        Online Store: jeans, clothing, shoes, bags and watches
trackingId                                   (&tid)       UA-123
viewportSize                                 (&vp)        1349x291
Executing Google Analytics commands.
Running command: ga("abc.send", "pageview")

Sent beacon:
v=1&_v=j44d&a=1234658035&t=pageview&_s=1&dl=https%3A%2F%2F  Some stuff here
_j1              (&jid) 
adSenseId        (&a)   1234658035
apiVersion       (&v)   1
clientId         (&cid) 819866210.1464779007
.
.
.
Executing Google Analytics commands.
Running command: ga("xyz.send", "pageview")

Sent beacon:
v=1&_v=j44d&a=1234658035&t=pageview&_s=1&dl=https%3A%2F%2Fau Again some stuff

_j1              (&jid) 
adSenseId        (&a)   1234658035
apiVersion       (&v)   1
clientId         (&cid) 819866210.1464779007

很抱歉粘贴这么大的控制台。 我控制台我可以看到所有的展示数据只发送到一个跟踪帐户。是否有其他2个跟踪帐户获取数据?

2 个答案:

答案 0 :(得分:0)

你有参数'产品类别',这是错误的 使用名称'category'

答案 1 :(得分:0)

使用多个跟踪器跟踪增强型电子商务时,您需要包含跟踪器名称,​​并基本上复制特定跟踪器的所有电子商务呼叫,例如:

ga('require', 'ec', 'ec.js'); // unnamed tracker
ga('abc.require', 'ec', 'ec.js'); // abc tracker
ga('xyz.require', 'ec', 'ec.js'); // xyz tracker

// ...

ga('ec:addImpression', .....); // unnamed tracker
ga('abc.ec:addImpression', ......); // abc tracker
ga('xyz.ec:addImpression', ......); // xyz tracker

// ...

ga('send', 'pageview'); // unnamed tracker
ga('abc.send', 'pageview'); // abc tracker
ga('xyz.send', 'pageview'); // xyz tracker
相关问题