User Custom vars tracking

In addition to the default pageview tracking, Compass supports a more fine-grained approach for your custom events in the context of a user navigation.

This feature is only available on the Enterprise Pricing Plan.

You can track as many events as you need, at any point during a user’s visit, even before the Marfeel SDK loads.

All events follow the same key-value pair model:

window.marfeel.cmd.push(['compass', function(compass) {
	compass.setPageVar('key', 'value');
	compass.setSessionVar('key', 'value');
	compass.setUserVar('key', 'value');


  • setPageVar is used for actions where the current page is important. i.e.: social sharing
  • setSessionVar is used to persist information at the visit or session level
  • setUserVar is used to persist user level information

User page information

Track page-specific actions or information by setting a page variable. Compass can track a different value for each pageview.

Example: Track when a user shares the page

window.marfeel.cmd.push(['compass', function(compass) {
	compass.setPageVar('share', 'twitter');

Compass associates this variable with the current pageview.

User session information

A session variable is a piece of information that stays unchanged for the whole duration of the user’s visit to your site.

Example: Track when a user subscribes to push notifications

window.marfeel.cmd.push(['compass', function(compass) {
	compass.setSessionVar('push', 'requested');
	compass.setSessionVar('push', 'accepted');
	compass.setSessionVar('push', 'rejected');

User information

Use Compass’s user variables to add information specific to each reader. This information stays valid between user visits.

Example: track readers subscribed to your push notifications.

window.marfeel.cmd.push(['compass', function(compass) {
	compass.setUserVar('push', 'subscribed');