Page View Tracking

Page view events are a special event type used for tracking navigation on your site. This information can be leveraged for engagement and funnel optimization, or to associate a map of attributes with a given page.

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. You can check the documentation for your integrations to confirm if you need to send page view 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 with a page view event.

The web SDK’s logPageView method takes three arguments:

  • Page Name (string)
  • Attributes (object)
  • Custom Flags (object)

If you do not include any arguments, the SDK will use the value of window.location.pathname as the page name and will include the page title and hostname as attributes. If you have any querystring params in your URL you are likely to quickly exceed unique event name limitations - so try to always explicitly log a page name.

//log the page view with details
	"Destination Details",
	{rating: "5", property_type: "hotel"},
	{"Google.Label": "search"}

Was this page helpful?