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.
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025