User Custom Dimensions 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.

TIP
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');
}]);

Where

  • 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

Page vars

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.

Session vars

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 vars

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');
}]);

User segments

A user segment refers to a specific group or category of users who share similar characteristics, behaviors, or preferences. User segments can be defined based on various criteria, such as demographics, browsing habits, or interaction with content. If you are tracking user segments passing them to Marfeel will help analyze your content, advertising, and user experiences to better meet the needs and interests of these distinct user groups.

Adds a new persistent user segment

window.marfeel.cmd.push(['compass', function(compass) {
	compass.addUserSegment('segment');
}]);

Replaces existing user segments

window.marfeel.cmd.push(['compass', function(compass) {
	compass.setUserSegments(['segment', 'segment2']);
}]);

Removes existing user segment

window.marfeel.cmd.push(['compass', function(compass) {
	compass.removeUserSegment('segment');
}]);

Clears all user segments

window.marfeel.cmd.push(['compass', function(compass) {
	compass.clearUserSegments();
}]);