Hi All,
I am trying to send User data for google ads enhanced conversion pixel on successful purchases. I have tried following code inside the customer events but upon validating the pixel the email is not getting passed.
Anyone has any solution for this ?
analytics.subscribe("checkout_completed", (event) => {
gtag('event', 'conversion', {
'send_to': 'xxxxxxxxxxxxxxxxxx',
'value': event.data.checkout.totalPrice.amount,
'currency': event.data.checkout.currencyCode,
'transaction_id': event.data.checkout.order.id
});
gtag('set', 'user_data', {
"email": event.data.checkout.email,
"phone_number": event.data.checkout.phone,
"address": {
"first_name": event.data.checkout.shippingAddress.firstName,
"last_name": event.data.checkout.shippingAddress.lastName,
"city":event.data.checkout.shippingAddress.city,
"postal_code": event.data.checkout.shippingAddress.zip,
"country": event.data.checkout.shippingAddress.country
}
});
});