How to debug blank page_viewed custom pixel event?

Hello,

Do any of you have recommendations for debugging blank “page_viewed” events please? I’m trying to create a standard custom pixel for Google Tag Manager. Other events are firing without issue.

I am using the Shopify PixelHelper by clicking on ‘test’ from the custom pixel page at the moment but can also see the same results via console.log().

My code is as follows:

analytics.subscribe("page_viewed", (event) => {
  window.dataLayer.push({
    event: "shopify_page_view",
    url: event.context.document.location.href,
    language: event.context.document.language || navigator.language,
    page_title: event.context.document.title,
    timestamp: event.timestamp
  });
});

I’ve tried everything I can think of.

  • tried different browsers (including Incognito mode)

  • read countless docs, official and otherwise, online

  • asked a Shopify advisor

  • scanned various forums

  • etc

Any ideas or suggestions please?