Skip to content

Tracking Page Views

While CustomerLabs tracks standard page views by default, you can use the Javascript API to track specific page view types like Category Viewed, Product Viewed, or Pricing Page Viewed.



Examples for Custom Page View:

  • Category viewed
  • Product viewed
  • Cart viewed
  • Thank you page viewed
  • Any custom event names can be used here.

_cl.pageview(eventName, properties)

Use this snippet to track when a user visits a specific category page.

var eventName = "Category viewed";
var properties = {
"customProperties": {
"page_url": {
"t": "string",
"v": window.location.href
},
"category_name": {
"t": "string",
"v": "Example Category"
}
}
};
_cl.pageview(eventName, properties);

There are no mandatory parameters for page view event to be included in the customProperties object. However, you can include any valid string or number as a parameter to the customProperties object such as page_url, page_title, category_name, etc. based on the event and context.