Woocommerce data layer for single product and variable product
-
Good day!
First this plugin is really awesome and thanks a lot for it. Second I’m having some problems setting a data layer variable(product’s ID) at Google Tag Managere for Facebook pixel events because of differences in the data layer’s output with the single product and variable product.
The output of the single product is as follows:
{“pagePostType”:”product”,”pagePostType2″:”single-product”,”productIsVariable”:0,”ecommerce”:{“currencyCode”:”USD”,”detail”:{“products”:[{“name”:”Sample Product”,”id”:20,”price”:”1.00″,”category”:”Uncategorized”,”stocklevel”:9}]}}})
While on a variable product its:
{“pagePostType”:”product”,”pagePostType2″:”single-product”,”productIsVariable”:1,”ecomm_prodid”:”25″,”ecomm_pagetype”:”product”,”ecomm_totalvalue”:”1″}
Getting the product’s id data layer variable with a simple product is as follows: ecommerce.detail.products.id
While on a variable product its: ecomm_prodid
The currency is not possible to get as well on the variable product.
So is there any way for me to get the data layer for product id for both the simple product and variable product?
Thanks!
- The topic ‘Woocommerce data layer for single product and variable product’ is closed to new replies.