Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Having a hard getting purchase info back to X ads with pixel code. Site vists/lands working fine. See anything wrong in my code?
!function(e,t,n,s,u,a){e.twq||(s=e.twq=function(){s.exe?s.exe.apply(s,arguments):s.queue.push(arguments);
},s.version="1.1",s.queue=[],u=t.createElement(n),u.async=!0,u.src="https://static.ads-twitter.com/uwt.js",
a=t.getElementsByTagName(n)[0],a.parentNode.insertBefore(u,a))}(window,document,"script");
twq("config", "myaccount");
analytics.subscribe("checkout_completed", (event) => {
twq('event', 'purchasecode', {
'value': event.data.checkout.subtotalPrice.amount,
'currency': event.data.checkout.currencyCode,
'email_address': event.data.checkout.email,
'contents': contents,
'conversion_id': order.number,
'phone_number': order.customer.phone
});
});
The contents, conversion_id, phone_number values seem sketchy unless you defined them as variables earlier in the code. For example, the correct notation for the order_id should be
'conversion_id': event.data.checkout.order.id
Second of all: Does this event work for other non-twitter scripts? You could maybe check with a console.log in the subscribe function and a test order.
Discover how to increase customer engagement on your store with articles from Shopify A...
By Jacqui Apr 23, 2025Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025