RFV Javascript SDK and API endpoint

Marfeel exposes User RFV during the session of a user through the Marfeel SDK and via API

RFV via Javascript SDK

Compass exposes the RFV score of the user in session, and its components, in the frontend.

Once marfeel-sdk has been loaded, retrieve the RFV via compass instance passing a callback function:

window.marfeel = window.marfeel || { cmd: [] };
window.marfeel.cmd.push(['compass', function(compass) {
	compass.getRFV((rfv) => {
       // { "rfv": 9.91, "r": 18, "f": 4, "v": 9 }
    })); 
}]);

It calls your callback function with an object with the RFV and its components.

RFV API endpoint

The RFV is also available via Marfeel’s API. The endpoint requires your account ID and the specific user ID you want to access:

Endpoint: https://compassdata.mrf.io/rfv.php

Parameter Explanation Example
ac Your account ID 107
u The user ID 820c10f4-ec6c-40b4-9cb4-80db5025bbea
GET https://compassdata.mrf.io/rfv.php?ac=107&u=820c10f4-ec6c-40b4-9cb4-80db5025bbea

This endpoint returns the same thing as the JavaScript function, an object containing the RFV value and its components.

Sharing the RFV

Compass is compatible with the IAB Europe Transparency and Consent Framework (TCF), it automatically retrieves user choices in regards to privacy as long as the websites uses a TCF CMP.

More information: Compass and consent management

Sharing with Piano

If the reader has accepted personalization, you can share the RFV score calculated by Compass with your other tools, such as Piano.

You can use Compass instance to do so, with the following snippet for example:

window.marfeel = window.marfeel || { cmd: [] };
window.marfeel.cmd.push(['compass', function(compass) {
	compass.getRFV(({rfv}) => {
        var userType;

        if (rfv <= 1) {
            userType = 'new';
        } else if (rfv <= 10) {
            userType = 'fly-by';
        } else if (rfv <= 35) {
            userType = 'casual';
        } else if (rfv <= 60) {
            userType = 'loyal';
        } else {
            userType = 'lover';
        }

        window.tp.push(["setCustomVariable", "compassEngagement", userType]);
    });
}]);