Copy Amount from Data into dimension/metric?

Hi community,

I have a client who does not run an Ecommerce website but they do sell gift cards and are interested in capturing the purchase price of each transaction into Piwik Pro, perhaps as a custom dimension. Here’s what the data layer contains with “totalAmount” being the field they want to capture into PP. Any thoughts??

{
event: “gtm.historyChange-v2”,
gtm: {
uniqueEventId: 141,
start: 1764170069581,
scrollThreshold: 90,
scrollUnits: “percent”,
scrollDirection: “vertical”,
triggers: “37”,
priorityId: 7,
element: “HTMLButtonElement: section.p-4 > button.button.is-prima” +
“ry.is-block.is-fullwidth.has-text-centered#submit-button”,
elementClasses: “button is-primary is-block is-fullwidth has-text” +
“-centered”,
elementId: “submit-button”,
elementTarget: “”,
elementUrl: “”,
historyChangeSource: “pushState”,
oldUrlFragment: “/booking/select-my-cart”,
newUrlFragment: “/booking/thanks”,
oldHistoryState: {idx: 4, usr: null, key: “7p937xbn”},
newHistoryState: {
usr: {
order: {
id: 2025330121810,
status: “COMPLETE”,
taxAmount: 0,
totalAmount: 1,
dueInSalon: 0,
dueToday: 1,
amountLeft: 0,
items: {
services: ,
giftCards: [
{
id: 6751902,
promotionalDiscountAmount: 0,
postOrEmail: “EMAIL”,
amount: 1,
toName: “David”,
fromName: “David Scott Culbertson”,
toEmailAddress: “davidsculbertson@gmail.com”,
fromEmailAddress: “davidsculbertson@gmail.com”,
deliverOn: “2025-11-26”,
message: “Enjoy your gift!”,
isBonus: false
}
]
},
payments: {
giftCards: ,
creditCards: [
{
id: 7072075,
amount: 1,
cardType: “VI”,
accountNumber: “************2467”
}
]
}
}
},
key: “3q0nx6pf”,
idx: 5
},
oldUrl: “ Online Booking - Powered by SalonBiz ,
newUrl: “ Online Booking - Powered by SalonBiz
},
page: {
title: “Online Booking - Powered by SalonBiz - Thanks!”,
url: “ Online Booking - Powered by SalonBiz +
“booking/thanks”
},
eventCallback: “Function”

Hi David,

For a case like that I think there are two paths:

  1. Using ecommerce tracking
  2. Using custom events

1. using ecommerce tracking would be the best option as gift card is behaving here like a standard product that you can purchase, which would allow for the best experience in regards to analysing data.

2. As for custom event option, this one although less advanced, would still allow you for some analysing, custom event value is currently next to goal value what we do have in regards to custom metrics that you can do calculations based on, if you would put the transacation value into a custom dimension, you would not be able to for example get a total sum or an average as it would be seen just as a string. So while ecommerce tracking would be the way to go in my opinion, you are able to capture totalAmount and then see the sum of it in analytics if you’d use custom event value (or goal revenue - especially if you have multiple currencies, or just see each purchase as a goal conversion) to hold that information

Best,

Oliwer

1 Like