Unable to get collection_viewed customer event to fire

rshopshear
Shopify Partner
2 0 0

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. 

Replies 2 (2)

Liam
Shopify Staff
2731 301 780

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:

  1. Using the browser's console: 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
  });
});
  1. 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.

  2. 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.

  3. 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

hashcode_io
Shopify Partner
105 3 10

@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

Shopify Team @ Conversios System
Please confirm its success with a like or marking it as a solution!
Google analytics 4
SST - Server-side tagging solution.
#martech#GA4 #GTM #ownGTM #SST #ServerSideTagging