SEO, AdWords, affiliates, advertising, and promotions
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
}
});
});
Hey @Charuhas ,
Did you add the Google Ads base code and enable the enhanced conversion tracking site-wide?
Thank You.
Hello,
Thank you for the message. Yes I have set the google ads base code and conversion as below. Let me know incase if anything flags out to you.
analytics.subscribe('page_viewed', (event) => {
// Load gtag.js script.
const script = document.createElement('script');
script.setAttribute('src','https://www.googletagmanager.com/gtag/js?id=AW-111111111');
script.setAttribute('async', '');
document.head.appendChild(script);
// Configure gtag.js script.
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'AW-11111111',{'allow_enhanced_conversions':true });
});
Thank you !
Charuhas
Hey @Charuhas ,
Could you please share the website URL so that I can further look into the implementation and provide you with detailed feedback?
Thank You.
As 2024 wraps up, the dropshipping landscape is already shifting towards 2025's trends....
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024In today’s interview, we sat down with @BSS-Commerce to discuss practical strategies f...
By JasonH Nov 13, 2024