diff options
| author | trisusilo48 <tri.susilo@altama.co.id> | 2024-11-18 11:35:58 +0700 |
|---|---|---|
| committer | trisusilo48 <tri.susilo@altama.co.id> | 2024-11-18 11:35:58 +0700 |
| commit | fb58a58715a7f5530a60479487457e5e0a1a41ec (patch) | |
| tree | 733f0332f127a4d6bc931330ec1cd103968dbb7d /src/lib/checkout | |
| parent | 0d4278bd482d2ec2563b29cb3597eb8c7227a2d7 (diff) | |
| parent | bde516b6b39cccfe8ac3248cd7f85592e6298d7a (diff) | |
Merge branch 'new-release' into feature/integrasi_biteship
Diffstat (limited to 'src/lib/checkout')
| -rw-r--r-- | src/lib/checkout/components/Checkout.jsx | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx index 4dd715d7..33cfaa87 100644 --- a/src/lib/checkout/components/Checkout.jsx +++ b/src/lib/checkout/components/Checkout.jsx @@ -40,6 +40,18 @@ const SELF_PICKUP_ID = 32; const { checkoutApi } = require('../api/checkoutApi'); const { getProductsCheckout } = require('../api/checkoutApi'); +function convertToInternational(number) { + if (typeof number !== 'string') { + throw new Error("Input harus berupa string"); + } + + if (number.startsWith('08')) { + return '+62' + number.slice(2); + } + + return number; +} + const Checkout = () => { const router = useRouter(); const query = router.query.source ?? null; @@ -454,6 +466,13 @@ const Checkout = () => { transaction_id: isCheckouted.id, }); + gtag('set', 'user_data', { + email: auth.email, + phone_number: convertToInternational(auth.mobile) ?? convertToInternational(auth.phone), + }); + + gtag('config', 'AW-954540379', { ' allow_enhanced_conversions':true } ) ; + for (const product of products) deleteItemCart({ productId: product.id }); if (grandTotal > 0) { const payment = await axios.post( |
