While I’m testing, I can observe the ‘page_view’ event being pushed to the dataLayer in the console, but I cannot see it in the Chrome extension ‘Tag Assistant Legacy’.
As a test, I changed the event from ‘checkout_completed’ to ‘checkout_started’, and everything worked as expected. I could see this event in the Chrome extension ‘Tag Assistant Legacy’.
This is actually a major issue judging from what I have been reading in the community threads lately. Devs as well as Admins are facing similar issues from the same API spec. From what I gathered:
This appears to be a shop-individual issue (I have 3 clients for which the trigger works and 1 for which the checkout_completed trigger does not work)
This in turn means there could be multiple sources of origin ranging from apps, payment options, shop config to files served in the checkout.
Based on my oberservations this is a shopify API issue with the event not being triggered or not being exposed in the customer events pixels. How I checked:
I created a “Console Log” Web Pixel which basically just logged all Standard and Custom events to the console.
analytics.subscribe(“all_events”, (event) => {console.log(event)}
If the event “checkout_completed” shows up in the console, I know that I am the problem in this equation. If it does not it is likely a backend / web pixels issue.
Turns out: It’s a web pixels issue. But I have a feeling this could still be related to my client’s shopify configuration.
Therefore I recommend also checking other console log events that appear during a test order.
I see
a MIME type issue with “Refused to apply style from” from some private_access_token URL source
and some warnings concerning a google maps API call being deprecated
as well as a warning for a document.write not working for an amazon payment script (I paid by credit card for the test order)
To sum up: I did not fix the issue. But I hope I might have provided some insights into getting closer to troubleshooting this.
Docs say “It’s triggered once for each checkout, typically on the Thank you page” - I wonder if it’s because we haven’t switched Thank you and Order status pages to Checkout Extensibility.
I don’t want to upgrade Thank You page now, since it it doesn’t seem there’s an easy way to switch back to checkout.liquid for the page.
This is actually connected to checkout extensibility. As long as there is code in the checkout thank you box on the backend the checkout_completed event does not seem to trigger. However, all other’s do trigger: add_payment_info etc.
There is actually a workaround to this. You can use the web pixels API from within the checkout-code box to pass the conversion to the customer events sandbox.
My initial plan was to keep the GTM script we have in checkout.liquid and use it to pass data along. It’s gets a bit complicated since we’re going to upgrade info, shipping and payment pages to checkout extensibility, but keep checkout.liquid for the thank you and order summary pages.
I don’t think this would work.
It is important to know where to implement these parts.
The analytics.subscribe call and the GTM-function belong in the customer events pixels.
the analytics.publish part belongs in your checkout-settings (the one where you post the extra code) or your checkout.liquid. (wrapped in a script tag)
On the other hand I would not name the conversion the same as the Shopify standard event - just to be on the save side and avoid complications with it. Name it something like custom_purchase e.g.
Then there is an issue in the analytics.subscribe function. The data you pass for custom events is available via event.customData. event.customData.transaction_id would return your transaction ID you passed into the publish-call earlier
I’m not totally sure I understand it yet. Is it possible to create a custom app with the web pixels API and put there the Shopify.analytics.publish method to publish custom analytics events? Then I could subscribe to it from the customer events pixel with analytics.subscribe method and push it to the GTM? I know that web pixels API doesn’t allow to sending of data directly to GTM.
Oh, ok thanks, but what if I migrated fully to the checkout extensibility and don’t have access to the checkout.liquid and Additional Scripts anymore? Do you think I can put the snippet from Additional Scripts into the Custom Pixel app I created and activate it? Then subscribe to the event in the Customer Events. New checkout is very tricky and complicated regarding the analytic stuff.
This is all just a temporary workaround for the transition period into checkout extensibility.
However, from what I have seen across different customer shops, after you fully migrated every checkout step to checkout extensibility, the analytics.subscribe(“checkout_completed”) method should work in the customer events section. This means that you won’t have to push the conversion event anywhere and you probably won’t be needing any additional custom apps for your checkout_completed events to available via the customer events (in theory).
This all seems to be a temporary issue in shops not fully migrated yet.