From 6e7aa296bae3e290785da7ad941c521a685be1e9 Mon Sep 17 00:00:00 2001
From: trisusilo48 <tri.susilo@altama.co.id>
Date: Thu, 14 Nov 2024 10:58:15 +0700
Subject: add google tag ads

---
 src/lib/checkout/components/Checkout.jsx | 26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)

(limited to 'src/lib/checkout/components/Checkout.jsx')

diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx
index e83e719c..afbf1e6c 100644
--- a/src/lib/checkout/components/Checkout.jsx
+++ b/src/lib/checkout/components/Checkout.jsx
@@ -413,7 +413,12 @@ const Checkout = () => {
       Math.round(parseInt(finalShippingAmt * 1.1) / 1000) * 1000;
     const finalGT = GT < 0 ? 0 : GT;
     setGrandTotal(finalGT);
-  }, [biayaKirim, cartCheckout?.grandTotal, activeVoucher, activeVoucherShipping]);
+  }, [
+    biayaKirim,
+    cartCheckout?.grandTotal,
+    activeVoucher,
+    activeVoucherShipping,
+  ]);
 
   const checkout = async () => {
     const file = poFile.current.files[0];
@@ -484,6 +489,11 @@ const Checkout = () => {
         transaction_id: isCheckouted.id,
       });
 
+      gtag('set', 'user_data', {
+        email: auth.email,
+        phone_number: auth.mobile ?? auth.phone,
+      });
+
       for (const product of products) deleteItemCart({ productId: product.id });
       if (grandTotal > 0) {
         const payment = await axios.post(
@@ -501,7 +511,7 @@ const Checkout = () => {
       }
     }
 
-   /* const midtrans = async () => {
+    /* const midtrans = async () => {
       for (const product of products) deleteItemCart({ productId: product.id });
       if (grandTotal > 0) {
         const payment = await axios.post(
@@ -1193,7 +1203,11 @@ const Checkout = () => {
                 <div className='text-gray_r-11'>
                   Biaya Kirim <p className='text-xs mt-1'>{etdFix}</p>
                 </div>
-                <div>{currencyFormat(Math.round(parseInt(biayaKirim * 1.1) / 1000) * 1000)}</div>
+                <div>
+                  {currencyFormat(
+                    Math.round(parseInt(biayaKirim * 1.1) / 1000) * 1000
+                  )}
+                </div>
               </div>
               {activeVoucherShipping && voucherShippingAmt && (
                 <div className='flex gap-x-2 justify-between'>
@@ -1494,7 +1508,11 @@ const Checkout = () => {
                         Biaya Kirim
                         <p className='text-xs mt-1'>{etdFix}</p>
                       </div>
-                      <div>{currencyFormat(Math.round(parseInt(biayaKirim * 1.1) / 1000) * 1000) }</div>
+                      <div>
+                        {currencyFormat(
+                          Math.round(parseInt(biayaKirim * 1.1) / 1000) * 1000
+                        )}
+                      </div>
                     </div>
                     {activeVoucherShipping && voucherShippingAmt && (
                       <div className='flex gap-x-2 justify-between'>
-- 
cgit v1.2.3

