Open catalog/view/theme/journal2/js/journal.js
Change 1: Add the following code at the end of the page/file
function gaAddtocart(e){$.ajax({url:"index.php?route=extension/module/google_ecommerce/get_product_info&product_id="+e,type:"post",dataType:"json",success:function(e){e.error?console.log(e.error):gtag("event","select_content",{"content_type": "product",items:[e.product_info]});gtag("event","add_to_cart",{items:[e.product_info]}),console.log(e.product_info),e.pixel_info&&(fbq("track","AddToCart",e.pixel_info),console.log(e.pixel_info))}})}function gaRemovefromcart(e){$.ajax({url:"index.php?route=extension/module/google_ecommerce/get_product_info&product_id="+e,type:"post",dataType:"json",success:function(e){e.error?console.log(e.error):gtag("event","select_content",{"content_type": "product",items:[e.product_info]});gtag("event","remove_from_cart",{items:[e.product_info]})}})}
Example:
Change 2: Add the following code as shown in two places
gaAddtocart(product_id);
Change 3: Add the following code as shown (only for OpenCart 2.1.0.1 and higher versions)
gaRemovefromcart(json.product_id);