skip to Main Content

I have implemented Google Analytics with multiple trackers using this url : https://developers.google.com/analytics/devguides/collection/analyticsjs/creating-trackers#working_with_multiple_trackers
Then have tried to implement enhanced ecommerce in it,But the product categories are not being tracked.In analytics panel , it is showing (not set). I don’t know where i went wrong since am not a SEO Expert.

In header :

<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>

In Product Listing,where all products of same category can be viewed

  <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.
  });

At the end

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

Here is the console :

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

Sorry for pasting such a large console.
I console i can see all the impression data being sent to only one tracking account.Is other 2 tracking accounts getting the data ?

2

Answers


  1. you have parameter ‘Product category’, it is wrong
    use name ‘category’

    Login or Signup to reply.
  2. When tracking enhanced ecommerce with multiple trackers, you need to include the tracker name and basically replicate all ecommerce calls for the specific tracker, for example:

    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
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search