Google Ads Conversion Tracking | Conversion Value

Dear Piwik PRO-Community,

Thanks to the great support of @pslonina since Oct. 22 we’ve already a working tag for E-Commerce-Tracking in Piwik PRO. It extracts the values from an existing DL and looks like follows:

<script>
var _paq = _paq || [];
(function () {
var ecObject = {{ ecommerce }}
var products = {{ ecommerce }}.items
products.forEach(function(product){
_paq.push(["addEcommerceItem", product.item_id, product.item_name, product.item_category, product.price, product.quantity]);
});
_paq.push(["trackEcommerceOrder", ecObject.transaction_id, parseFloat(ecObject.value),, parseFloat(ecObject.tax), parseFloat(ecObject.shipping),]);
})();
</script>

Now I’d like to implement Conversion Tracking for Google Ads. To send not only the conversion but also the conversion value to Google Ads I’ve set a variable for “Conversion value” in this tag.

Now I need a script to extract the "Conversion value“ into this variable.

I’ve already tried to follow the instructions of @kuba (see How to track revenue for Google Ads - #5 by myvetshop), but unfortunately I’m not that familiar with JS.

Can you be of assistance? That’d be great!

Best regards

Jürgen

Hi @Juergen,

From what I see the order value is hidden in your case under {{ ecommerce }}.value.
Try custom JS variable like this:

function(){
    try{
        return {{ ecommerce }}.value;
    }catch{
        return null;
    }
}

in case that doesn’t work you just have to figure out where the revenue is hidden in the dataLayer for ecommerce and change .value to wherever the correct value is.

Also, your current solution uses outdated methods for tracking ecommerce, I’d recommend trying out our new ecommerce methods and tags. Here is an article about that Big changes in ecommerce: what's new and how to update your current tracking | Piwik PRO help center

(older ones still work, it’s more about how simple it is to use new ecommerce tags and how much more in-depth you can go with new product dimensions)

Best,
Oliwer

Hi @Oliwer_Kaczmarek ,

Many thanks for your feedback :+1:

Looks good! In Tracker debugger I see the variable “Purchase revenue” filled with the purchase revenue.

Best,

Jürgen