I’m using Piwiks Tag Manager and I’m getting conversions sent to Google Ads, but not the revenue from the conversions.
The ecommerce tracking is working, so I’m getting revenue into Piwik.
I’ve tried setting up a variable so I could send data to Google manually as per your guides, but I can’t get the revenue to show up in the variable.
I’ve tried to set the variable up as it used to be in Google tag manager: ecommerce.purchase.actionField.revenue
I’ve also tried to set it up like it is in the Piwik conversion tag: orderDetails.purchase.actionField.revenue
Can you help me either get data in the variable or is there an easier way to get conversion value sent to Google Ads?
I could go back to tracking through Google Tag Manager, but then I get a _gcl_au cookie I can’t put in Piwik Consent Manager
Can you share details about your current setup? Paste the datalayer without using a screenshot, showing the definition of variables (especially those that are working correctly now). Piwik PRO Tag Manager does not support nested datalayer variables yet. Most likely that’s the issue. It can be solved with some custom coding to get the nested values.
{ “purchase”: { “actionField”: { “id”: “000001052”, “affiliation”: “Main Website - Main Website Store - Default Store View”, “revenue”: “19.9600”, “coupon”: “”, “tax”: “14.7900”, “shipping”: “39.2000” }, “products”: [ { “name”: “Little One Sticks med frugt, 2x60 g”, “id”: “354003”, “price”: “19.96”, “brand”: “Little One”, “category”: “Kanin og Gnaver/Gnaver- og Kaninfoder”, “list”: “Kanin og Gnaver/Gnaver- og Kaninfoder”, “quantity”: 1 } ] }, “currencyCode”: “DKK” }
gtm.start
1674028583535
gtm.unique…
3
The ecommerce tag that’s working now is:
var _paq = _paq || ;
var orderDetails = {{ ecommerce object }};
var products = orderDetails.purchase.products;
var order_id = orderDetails.purchase.actionField.id;
var grand_total = orderDetails.purchase.actionField.revenue;
var tax = parseInt(orderDetails.purchase.actionField.tax);
var shipping = orderDetails.purchase.actionField.shipping;
var discount = orderDetails.purchase.actionField.coupon;
Well I want to get the conversion value on Google Ads conversions sent to Google Ads.
Currently all orders have 0 as value because I can’t get my Purchase revenue variable to have the value in it, so I don’t have anything to send through the Google Ads Conversion Tracking tag
Hi,
I’ve used this code, but I’m getting a lot of javascript errors on my product pages now saying stuff like:
Failed to evaluate variable - ProductID: Cannot read properties of undefined (reading ‘products’)
Failed to evaluate variable - Discount: Cannot read properties of undefined (reading ‘actionField’)
I’m guessing it’s because the variable is trying to read when it shouldn’t be, but I don’t know javascript so I don’t know how to include a check on wether “ecommerce” includes the actionField or not.
@Bacterfield I’m afraid that it would be hard to set it up without JavaScript knowledge. For the mentioned error, most likely your dataLayer object doesn’t have the following property.
My code example included a basic check:
if (typeof yourvariable !== 'undefined')
You could use it to check other vars (even those with nested values).