From a235f77530f0f51b3637b4b1096552fe3058ed69 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Fri, 16 Jun 2023 10:10:25 +0700 Subject: Add gtag begin_checkout and purchase event --- src/lib/cart/components/Cart.jsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/lib/cart/components') diff --git a/src/lib/cart/components/Cart.jsx b/src/lib/cart/components/Cart.jsx index 907d1267..8c4e7d42 100644 --- a/src/lib/cart/components/Cart.jsx +++ b/src/lib/cart/components/Cart.jsx @@ -17,6 +17,7 @@ import DesktopView from '@/core/components/views/DesktopView' import ProductCard from '@/lib/product/components/ProductCard' import productSearchApi from '@/lib/product/api/productSearchApi' import whatsappUrl from '@/core/utils/whatsappUrl' +import { gtagBeginCheckout } from '@/core/utils/googleTag' const Cart = () => { const router = useRouter() @@ -134,6 +135,11 @@ const Cart = () => { toast.success('Berhasil menghapus barang dari keranjang') } + const handleCheckout = () => { + gtagBeginCheckout(products) + router.push('/shop/checkout') + } + return ( <> { type='button' className='btn-solid-red flex-1' disabled={selectedProduct().length == 0} - onClick={() => router.push('/shop/checkout')} + onClick={handleCheckout} > Checkout -- cgit v1.2.3