dhpwd
May 8, 2023, 12:18pm
1
Hi there,
Context : we’re implementing a custom web pixel (https://help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels ), starting with the checkout_completed event
Problem : we’re not able to access the customer’s ID, first or last name
Customer ID : we’re looking at the init.data.customer object (per https://shopify.dev/docs/api/pixels/pixel-extension#web-pixel-api-reference ) however all fields are undefined (see below)
The event object (https://shopify.dev/docs/api/pixels/customer-events#event-structure ) contains clientId however this is an anonymous ID generated by the client, not the customer ID
First/last name : these should also be set on the same customer object, as well as on the event.data.checkout.shippingAddress object per https://shopify.dev/docs/api/pixels/customer-events#mailingaddress however they’re missing from both
This appears to be a bug?
Thanks,
Dan
3 Likes
Same here. Did you find a solution?
guimei
June 7, 2023, 11:05am
3
Same here. Did you find a solution?
I have the same problem..
dnv
August 25, 2023, 4:59am
5
In my case, the pixel sent event page_viewed on page “thank you”. but not send the checkout_completed. Is there any solution on this?
I don’t even see the customer object
Hello** @dhpwd **.
Have you found any solution to get the Customer ID in checkout_completed?
Hi! The Customer ID on the checkout_completed event is accessible within event.data.checkout.order.customer.id, for example;
analytics.subscribe('checkout_completed', (event) => {
console.log("event", event)
const customerId = event.data.checkout.order.customer.id
console.log("customerId", customerId)
})
The customer’s first and last name should also be accessible within either the event.data.checkout.shippingAddress and/or event.data.checkout.billingAddress.
init.data.customer requires the customer to be logged-in on the storefront or the checkout, in order to be able to access the associated Customer object and Customer Account on the shop - perhaps this explains why you were not seeing any customer data in that case?
Hopefully this helps! Please let us know if anything else is still unclear here or if you have any other feedback regarding this.
Hi, i have the same problem. Do you have a solution yet? Can you share it with me?