簡體   English   中英

使用增強型電子商務和Google Analytics(分析)跟蹤產品

[英]Tracking the products using Enhanced Ecommerce with Google Analytics

我已經使用以下網址使用多個跟蹤器實施了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個跟蹤帳戶是否正在獲取數據?

您具有參數“產品類別”,使用名稱“類別”是錯誤的

使用多個跟蹤器跟蹤增強型電子商務時,您需要包括跟蹤器名稱,​​並基本上復制特定跟蹤器的所有電子商務調用,例如:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM