View Single Post
  #1  
Old 06-15-2023, 12:11 PM
 
keystone keystone is offline
 

X-Adept
  
Join Date: Jul 2006
Location: USA
Posts: 787
 

Default add_to_cart event GA4

Has anyone successfully added an add_to_cart event for GA4 in xcart v.4.7.# using gtag?
I have the purchase event set up and working fine. Here is my current code...
Code:
{if $main eq "order_message" and $orders} <!-- Google Analytics 4--> <script> gtag('event', 'purchase'); {foreach $orders as $order} gtag( 'event', 'purchase', {csi_get_gtag_ecommerce_data event="purchase" order=$order.order products=$order.products} ); {/foreach} </script> <!-- End Google Analytics 4 --> {/if}
__________________
www.uscandleco.com - X-Cart Version 4.7.11 Gold Plus php7.3
mods:
reCaptcha
running on UNIX

www.keystonecandle.com X-Cart Gold Plus - Version 4.7.11 php7.2
mods:
reCaptcha
cdseo pro
running on UNIX
Reply With Quote