NexAddo
NexAddo

Reputation: 772

enhanced ecommerce conversion issues

This is the code being sent from our confirmation page for GA universal using enhanced ecommerce:

ga("create", "UA-XXXXXXX-xx", "auto");
ga("require", "displayfeatures");
ga("require", "ec");
ga("ec:addProduct", {
    Id: null, 
    Name: "ProductNameTest", 
    Brand: "Foo", 
    Category: null, 
    Variant: null, 
    Price: 5.49, 
    Quantity: 1, 
    Coupon: "", 
    Position: 0
});
ga("ec:setAction", "purchase", {
    Id: "33558", 
    Affiliation: "Foo", 
    Revenue: 5.49, 
    Tax: 0, 
    Shipping: 0, 
    Coupon: "", 
    List: null, 
    Step: 4, 
    Option: null
});
ga("send", "pageview");

I'm not seeing any issues in the GA debugger or in the Tag Assistant plugin for Chrome.

What am I missing here that our conversion data/transactions aren't showing up?

EDIT:

Here is the output from the GA debugger that I stripped for the above:

Initializing Google Analytics.
Loading resource for plugin: ec
Loading script: "http://www.google-analytics.com/plugins/ua/ec.js"
Running command: ga("create", "UA-XXXXXXX-xx", "auto")
Creating new tracker: t0
Running command: ga("require", "displayfeatures")
Set called on unknown field: "dcLoaded".
Plugin "displayfeatures" intialized on tracker "t0".
Running command: ga("require", "ec")
Waiting on require of "ec" to be fulfilled.
Executing Google Analytics commands.
Registered new plugin: ga(provide, "ec", Function)
Running command: ga("require", "ec")
Plugin "ec" intialized on tracker "t0".
Running command: ga("send", "pageview")

Upvotes: 0

Views: 2773

Answers (1)

Nick Blexrud
Nick Blexrud

Reputation: 9603

I see a few issues that could be affecting your transactions:

  1. Duplicate ga("require", "ec") commands.
  2. Id for addProduct is null. This is a required value, and should be a string.
  3. More of a javascript best practice: after you've invoked your function, end it with a semicolon. e.g. ga("send", "pageview");

EDIT: Regarding point #2, the Id for addProduct CAN be null, if the developer is passing a value for the name parameter instead (see Product Data table).

All property key's must be lowercase i.e. Id should be id. (Thanks for Eduardo for pointing out).

Upvotes: 4

Related Questions