How to debug blank page_viewed custom pixel event?

Topic summary

A developer is troubleshooting a custom pixel implementation for Google Tag Manager in Shopify where page_viewed events are firing but contain no data (appearing blank). Other events work correctly.

Current setup:

  • Using analytics.subscribe("page_viewed") to push data to window.dataLayer
  • Testing with Shopify PixelHelper and console.log()
  • Code attempts to capture URL, language, page title, and timestamp from the event object

Troubleshooting attempts:

  • Tested across multiple browsers and incognito mode
  • Consulted official documentation and forums
  • Contacted Shopify support

Status: The issue remains unresolved. The developer is seeking recommendations for debugging why the event object appears empty despite the subscription triggering successfully.

Summarized with AI on October 29. AI used: claude-sonnet-4-5-20250929.

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?