Issue with detecting checkout_completed event using Web Pixel app extension

fooc
Shopify Partner
4 0 8

Hello everyone,

 

I am currently developing a Web Pixel app extension.

I have implemented the subscription to the checkout_completed event, but I am experiencing inconsistent detection of this event, even when using the same environment and following the same steps to complete a purchase.

 

I have followed the implementation guide provided in the Shopify documentation:(https://shopify.dev/docs/apps/marketing/pixels/getting-started)

Here is an example of the code I am using:

import { register } from '@shopify/web-pixels-extension'

register(({ configuration, analytics, browser, settings, init }) => {
  analytics.subscribe('checkout_completed', async event => {
    console.log('checkout_completed:', event)
  })
})

I am using the latest version of `@shopify/web-pixels-extension`, which is currently 0.4.12.

 

If anyone has encountered a similar issue or knows of a solution, I would greatly appreciate your insights and guidance.

 

Thank you in advance for your assistance.

Best regards,

Replies 29 (29)

1080
Shopify Partner
296 9 50

@fooc  I just started working on,  can you share the your issue step, may be I can help. 

fooc
Shopify Partner
4 0 8

@1080 Hi, Thank you for your reply.

Unfortunately, there are no specific steps to reproduce the problem.

In our case, out of all purchases, there are about 25% of cases where the "checkout_completed" event is not being triggered.

iwasdenied
Shopify Partner
1 0 1

I agree with @fooc, this problem is very strange. On one store, everything is tracking fine, and on another, 10 checkouts are only going through 3. Tell me, have you had any success with the solution?

clubyolo
Visitor
2 0 2

@fooc @1080 Hi, I have the same problem. Did you find a solution ?

1080
Shopify Partner
296 9 50

@clubyolo  yes I have found the root cause. it Shopify checkout is trigger but the cookies consent app may be blocking. do you have any data or  Rayid you can contact to the shopify team if not trigger from the Shopify side. 

FabianSchulcz
Shopify Partner
3 0 4

Hi @fooc and @1080, we also noticed this problem. We do not see any pattern when it works and when it does not. Of course it ideally always has `order.id` as well. As asked for in e.g. those threads: 1, 2  
Any updates on this, or empty order object?    

We are still searching for a way to a) reliably get order data which is b) complete on client side.
Improvements would be appreciated a lot.

1080
Shopify Partner
296 9 50

@FabianSchulcz  Not yet

xiddixaid
Shopify Partner
37 0 13

It has been since 13th of May merchants facing this issue but shopify do not want to solve this issue and support will give you lame excuses.

1080
Shopify Partner
296 9 50

@xiddixaid 

 same with the me.

I try to reching out the Support team. but still no resolution.


May be this not right team that can help out. any one share which is concern team for that ?

@fooc @FabianSchulcz  @clubyolo  @iwasdenied  

 

FabianSchulcz
Shopify Partner
3 0 4

Hi @1080,

 

we'll also reach out to support. I do not know to which technical team it will be forwarded to. Hope it will match the request topic this time.    

 

@xiddixaid I haven't lost all hope that this promoted feature will eventually reach a stable state 🤞 Communication and support indeed leave a lot to be desired. 

 

Staff?

xiddixaid
Shopify Partner
37 0 13

Its not about the hope its about the money we are losing, spending on ads, facebook ads behaving in worst way because they are not counting conversion.

onlyup
New Member
4 0 0

What if we add the event on the order stats "thank you" page, instead of relying on the buggy 

analytics.subscribe("checkout_completed",..
xiddixaid
Shopify Partner
37 0 13

Shopify now recommend to use custom event instead placing code on thank you page. But, it behaves the same way as on thank you page.

ericute
Shopify Partner
57 4 7

Has din been sorted out?

1080
Shopify Partner
296 9 50

@ericute  not yet.

Josh_Uebergang
Shopify Expert
1018 44 273

2 months later and there seems to be progress on it.

 

According to Shopify's documentation about the event, checkout_completed is suppose to be available "on the order status and checkout pages". My tests show the event runs on upsells, but on the following order status page (often known as the thank you page), the event does not run. Surely that can't be intended.

 

When there is no upsell, the event runs on the order status page.

Run Google Shopping ads? Get the free definitive guide to Google Shopping for Shopify (no optin required): https://www.digitaldarts.com.au/google-shopping

jhelmer25
Shopify Partner
6 0 2

I can confirm that we are having this issue as well.

 

We were able to trace the data for individual users and see the event firing multiple times in a percentage of the cases.

 

As a workaround, our internal systems that are receiving the the `checkout_completed` event, deduplicate based on the order ID.

 

However I do agree that this is a bug in shopify, or at the very least, an undocumented behavior with when these `checkout_completed` events fire. We were not able to reproduce it ourselves no matter how hard we tried.

1080
Shopify Partner
296 9 50

Hi @jhelmer25  I have testing with customer event was working fine. also the app pixel it was trigger correct.

 

can i Know more about the your issue  how I can reproduce my side.? 

Clayton_L
Shopify Partner
3 0 6

checkout_completed isn't firing for me. I'm actually a shop admin trying to subscribe to the event using the "Customer Events" feature in the Shopify admin. I'm not having trouble with any other event not firing my handler. I tried stepping through the minified code that handles Customer Events to see what was happening. I see the event start to be fired, but it bails out before reaching the event subscription, and I can't tell why.

Clayton_L
Shopify Partner
3 0 6

I was testing by submitting real orders in incognito mode and using Chrome's JS debugger. All events were firing their subscriptions except for checkout_completed.

OURPETS
Visitor
1 0 1
hi

Clayton_L
Shopify Partner
3 0 6

Update: checkout_completed was firing for me today

rocketsurgery
Shopify Partner
2 0 4

@ShopifyDevSup any updates you can provide on what causes the checkout_completed event to fail? Can you offer workaround solutions that we can use to reliably capture this information?

https://shopify.dev/docs/api/web-pixels-api/standard-events/checkout_completed


 

zdunecki_ls
Shopify Partner
7 0 1

Hey, did Shopify solve the issue? We're still facing the same.

1080
Shopify Partner
296 9 50

@zdunecki_ls We are also facing the same issue. If you are a Plus customer, please get support from the Plus team. They will really help to get the issue resolved.

drivemtl
Shopify Partner
4 0 2

as far as i can tell, no, Shopify has not solved the issue.

 

i've been running multiple tests for the last few days using "Settings" > "Customer events" > "custom pixel".

 

i created our own test JS snippet as a way to instantly get feedback from the server, without having to wait on any FB or Google platform delays.

 

our snippet simply records the timestamp, an event name (whatever we set it to in the "dtag()" function), and a payload (for this test it's empty {}).

 

the code is below (with the snippet url removed for privacy reasons):

 

const script=document.createElement("script");
function dtag(){dtagQueue.push(arguments)}script.setAttribute("src",
"https://oursnippeturl.com/record.js"),script.setAttribute("async",
""),document.head.appendChild(script),window.dtagQueue=window.dtagQueue||[],
function t(){if("function"==typeof window.realDtag)for(
;dtagQueue.length;)window.realDtag.apply(this,dtagQueue.shift());
else setTimeout(t,50)}();

analytics.subscribe("checkout_completed", event => {
  dtag('checkout_completed', {});
});

 

"checkout_completed" (https://shopify.dev/docs/api/web-pixels-api/standard-events/checkout_completed) fires maybe once out of 10 orders.

 

when we replace the event with "product_viewed" (https://shopify.dev/docs/api/web-pixels-api/standard-events/product_viewed) the tag seems to fire every time

 

we've also confirmed that this is a Shopify issue. when we run this snippet test on any of our other non-Shopify sites, our JS snippets have no issue capturing whatever actions we send to it

 

this problem has been extremely frustrating and is costing our client money and making us look bad as well

zdunecki_ls
Shopify Partner
7 0 1

@drivemtl 

Thank you for comprehensive answer. I was thinking about creating a bot to make test orders on test shops with modified Shopify tracking code to catch an issue but it sounds like a do a lot of work to do this properly. And also I'm not quite sure if it's not working because of environment (not test). We did many tests on test environment and it was working like a charm.

drivemtl
Shopify Partner
4 0 2

my pleasure, @zdunecki_ls, I hope my notes can help others.

 

frustratingly, we ran this same code on another client's Store and it worked flawlessly. from what i can tell, it seems to be a Store-by-Store problem. i haven't done tests on enough Stores to prove this comprehensively though.

 

our next step is to reach out to the team at Shopify Plus with all of these notes to see what they say. if it's anything relevant, I'll share it here

zdunecki_ls
Shopify Partner
7 0 1

@drivemtl 

 

Awesome! Thanks!