custom metric is undefined

koen_de_keersma
Visitor
koen_de_keersma

Hello

 

I've added a custom metric to my Google Universal tag. 

It should be send when there is a new transaction. Therefore, I've mapped it like this in the GA tag under the metrics category:

 

- Event type: transaction

- Metric: metric1

 

21-11-2017 13-44-08.png

 

When I debug it, the google debug info tells me the metric is undefined: 

 

Running command: ga("gaMain.ecommerce:addTransaction", {metric1: undefined, id: "1511265721905", affiliation: "", revenue: "337.50", shipping: "", tax: "", currency: ""})

When I take a look in the utag_data object, the commerce_product_fraction is properly defined and filled in with an array:

 

21-11-2017 13-31-37.png

 

Does anyone know what I've did wrong? 

 

Thanks for the help! 

 

 

 

3 REPLIES 3
Highlighted

custom metric is undefined

AndreScholten
Visitor
AndreScholten

What if you create a new Data Layer variable (type: javascript variable) and call it "commerce_product_fraction[0]". Than it should get the first string within the array, @koen_de_keersma. Now you're trying to put an array into the custom metric.

Freelance Web Analist

custom metric is undefined

Tealium Employee

HI @koen_de_keersma

 

What @AndreScholten suggests is correct, you are trying to assign an array to the mapping, which will not work.

Using a Set Data Values Extension as suggested is the best option.

 

2017-11-23_1040.png

 

Adrian

Ask me anything Tealium related or Javascript, or NodeJS.
Please remember to mark solutions as accepted for future searchers.

custom metric is undefined

koen_de_keersma
Visitor
koen_de_keersma

Thanks guys! Did the job indeed.