Page View Tracking

You can track navigation on your site with page view events.

Some integrations treat page events separately from other event types, and require that you instrument navigation events as page views. Other partners don’t differentiate between page and other custom events. For most use cases, the best course of action will be to log your navigation events as page views and let mParticle translate your data into the appropriate format for each output integration.

Many output integrations are only interested in the page name, but you can also include a set of custom attributes and flags with a page view event.

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.toString()})
//log the page view with details
mParticle.logPageView(
	"Product Detail Page",
	{page: window.location.toString()},
	{"Google.Page": window.location.toString()} // if you're using Google Analytics to track page views
);

Was this page helpful?