adardesign
adardesign

Reputation: 35681

enhanced ecommerce analytics tracking on new tracker

I wanted to setup a separate account for enhanced ecommerce data so the data doesn't alter the main account

I read this article and followed it closely by setting up a new tracker like so

ga("create", "UA-XXXXX-XX", "auto", {
    "name": "newTracker"
});

ga("require", "ec");

Then products are added

ga("ec:addProduct", {
  "id": "b55da",
  "name": "Flexigen T-Shirt",
  "price": "16.00",
  "brand": "Flexigen",
  "category": "T-Shirts",
  "position": 0
});

But here is the issue I have

when I use ga("newTracker.send", "pageview"); It doesn't send the enhanced ecommerce data.. See: not sending EC data

But when I don't use the new tracker (but rather the default one ga("send", "pageview");) It does work correctly See: enter image description here

What is the issue?

Upvotes: 3

Views: 384

Answers (1)

CrayonViolent
CrayonViolent

Reputation: 32532

You created a new namespace, so if you want the stuff to be included in it, you need to put it under the namespace. So you need to namespace the require and ec command too:

  ga("create", "UA-XXXXX-XX", "auto", {    
    "name": "newTracker"
  });

  ga("newTracker.require", "ec");

  ga("newTracker.ec:addProduct", {
    "id": "b55da",
    "name": "Flexigen T-Shirt",
    "price": "16.00",
    "brand": "Flexigen",
    "category": "T-Shirts",
    "position": 0
  });

  ga('newTracker.send', 'pageview');

Upvotes: 6

Related Questions