Отслеживание продуктов с помощью расширенной электронной торговли с помощью Google Analytics

Я реализовал Google Analytics с несколькими трекерами, используя этот URL: https://developers.google.com/analytics/devguides/collection/analyticsjs/creating-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 ответа

При отслеживании расширенной электронной торговли с несколькими трекерами необходимо указать имя трекера и в основном повторить все вызовы электронной коммерции для конкретного трекера, например:

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

У вас есть параметр "Категория продукта", неверно использовать имя "категория"

Другие вопросы по тегам