Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
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?
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025