Page View Tracking

Log your navigation events as page views and let mParticle translate your data into the appropriate format for each output integration.

The web SDK’s logPageView method takes three arguments:

  • Event Name (e.g. "Product Detail Page")
  • Attributes (e.g. {"url": window.location.toString()})
  • Custom Flags (e.g. {"Google.Page": window.location.pathname.toString()})

The Event Name field should be set to a generic page name. For example, an e-commerce website could have hundreds of product detail pages. To log these correctly, you should use a generic name for Event Name (e.g. "Product Detail Page") and then log the url and other attributes of the page as Attributes.

mParticle.logPageView(
	"Product Detail Page",
	{page: window.location.toString()},
	{"Google.Page": window.location.pathname.toString()} // if you're using Google Analytics to track page views
);

Was this page helpful?