Topics covering webhook creation & management, event handling, Pub/Sub, and Eventbridge, in Shopify apps.
I have set up and subscribed to several events that work fine. I am trying now to get collection_viewed to work.
I can receive all of the checkout started, info submitted, etc. For context, when it fires, it will add a cookie, IP address ,etc.
Following similar example:
analytics.subscribe("collection_viewed", event => {
const collection = event.data.collection;
const collectionTitle = collection.title;
track.view_collection({
_source: some source,
shop_name: 'shop name',
collection: collection title
});
});
Is there a way to tell if the event is firing or not? I have tried this on accounts with Shopify Plus and without. The customer events work fine on either one.
Hi Rshopshear,
There are a few ways you can debug this event to see if it's firing or not. Here are a few methods you can use:
console.log
statement to print out the event data. This will give you a clear idea about whether your event is firing or not. For example:analytics.subscribe("collection_viewed", event => {
.log(event);
const collection = event.data.collection;
const collectionTitle = collection;
track.view_collection({
_source: some source,
shop_name: 'shop name',
collection: collection title
});
});
Using the Network tab in developer tools: You can monitor the network requests in your browser's developer tools. If the event is firing, you should see a network request being sent to the server.
Using a debugging tool: If you're using a tool like Google Tag Manager, they often have a debug mode that you can use to see if events are firing.
Checking server logs: If you have to server logs, you can check if the event data is being received on the server side.
Remember, the collection_viewed
event is available on the online store page and logs an instance where a buyer visited a product index page. Make sure you're correctly navigating to a collection page for the event to trigger.
Try out the above and let us know if you're still seeing an issue - hope this helps!
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
@Liam
I am also facing the serious issue with checkout_complete it many cases not trigger.
https://community.shopify.com/c/shopify-discussions/shopify-app-pixel-standard-event-not-working-tri...
https://shopifypartners.slack.com/archives/C4E5GV5U4/p1710851344762119
Customer Events:
https://youtu.be/CnLOo7qfB74?si=YI-4HiMXLQjQ4l8i
Customer Events - consent mode