summaryrefslogtreecommitdiff
path: root/src/lib/cart/components
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-06-16 10:10:25 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-06-16 10:10:25 +0700
commita235f77530f0f51b3637b4b1096552fe3058ed69 (patch)
treec3634c3aa5f6e858189a996178bc383add650aa4 /src/lib/cart/components
parent857ba27d9df9361fb0e8f4b77004e8c9a2b86110 (diff)
Add gtag begin_checkout and purchase event
Diffstat (limited to 'src/lib/cart/components')
-rw-r--r--src/lib/cart/components/Cart.jsx8
1 files changed, 7 insertions, 1 deletions
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 (
<>
<BottomPopup
@@ -465,7 +471,7 @@ const Cart = () => {
type='button'
className='btn-solid-red flex-1'
disabled={selectedProduct().length == 0}
- onClick={() => router.push('/shop/checkout')}
+ onClick={handleCheckout}
>
Checkout
</button>