AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

2.8K members online now
2.8K members online now
Learn how to set up goals and Ecommerce tracking, verify accuracy of attribution traffic sources, and discuss funnel visualization, Multi-Channel Funnels, the Goal Flow Report, and Enhanced Ecommerce
Guide Me

Add Transaction & pass just array of values, no param names?

Follower ✭ ✭ ✭
# 1
Follower ✭ ✭ ✭

I made need to update our .js from the old gstyle to the new analytics.,js library


In the old library you could do something like:


'Bungalow Trial CD- with fully-functional trials over 20 therapy programs',
' ',

But in the docs I see  you need to pass along each variable name:


ga('ecommerce:addItem', {
'id': '1234',                     // Transaction ID. Required.
'name': 'Fluffy Pink Bunnies',    // Product name. Required.
'sku': 'DD23444',                 // SKU/code.
'category': 'Party Toys',         // Category or variation.
'price': '11.99',                 // Unit price.
'quantity': '1'                   // Quantity.


I'm trying to make this upgrade as simple as possible so I'm hoping we can pass in the values as just an array, without having to pass the parameter name in as well.


But I can't find such a declaration anywhere.






1 Expert replyverified_user

Re: Add Transaction & pass just array of values, no param names?

Top Contributor
# 2
Top Contributor
Hi MrAnalogy,

Unfortunately, you will need to eventually map your values back to the specific Ecommerce parameter. Whether you set it as specified in the docs, or whether you do it via some code magic, bottom line is GA can only interpret and process your data if it's in the format they have specified.

Hope this helps.
Nicky Yuen, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here.
Find me on: Google+ | LinkedIn