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.
Custom vars can be understood as specific attributes of a user in the context of page hit, the span of a session or his lifecycle as a user.
Tracking page-specific actions or information by setting a page variable you can:
- Measure pages that have been dynamically closed
- Pages the user has played a video on
- Pages the user has clicked on an affiliation link
- Track response codes
- Calculated metrics like PVs with >30% scroll
- …
You can track pieces of information that stays unchanged for the whole duration of the user’s visit to your site to:
- Track the number of closed pages a user has visited in a session
- Track if the user has visited the pricing page
- Consent Choice
- Ad Blocking
- Digital Wallet available
- …
Use Marfeel’s user variables to add information specific to each reader
- Absolute number of hits to closed page views
- Date of first visit
- Days until subscription renewal
- Has visited the subscription page
- Has visited the home
- CRM-like data: gender, age, interest groups, etc.
- …
Basic Usage
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 = window.marfeel || { cmd: [] };
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 sharingsetSessionVar
is used to persist information at the visit or session levelsetUserVar
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 = window.marfeel || { cmd: [] };
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 = window.marfeel || { cmd: [] };
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 = window.marfeel || { cmd: [] };
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 = window.marfeel || { cmd: [] };
window.marfeel.cmd.push(['compass', function(compass) {
compass.addUserSegment('segment');
}]);
Replaces existing user segments
window.marfeel = window.marfeel || { cmd: [] };
window.marfeel.cmd.push(['compass', function(compass) {
compass.setUserSegments(['segment', 'segment2']);
}]);
Removes existing user segment
window.marfeel = window.marfeel || { cmd: [] };
window.marfeel.cmd.push(['compass', function(compass) {
compass.removeUserSegment('segment');
}]);
Clears all user segments
window.marfeel = window.marfeel || { cmd: [] };
window.marfeel.cmd.push(['compass', function(compass) {
compass.clearUserSegments();
}]);