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 in the frontend.

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

window.marfeel.cmd.push(['compass', function(compass) {
	compass.getRFV((rfv) => {
       // { rfv: "3.83" }
    })); 
}]);

It calls your callback function with an object with the RFV value as a String.

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://events.newsroom.bi/data.php

Parameter Explanation Example
ac Your account ID 107
u The user ID 820c10f4-ec6c-40b4-9cb4-80db5025bbea
GET https://events.newsroom.bi/data.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 as a String.

Sharing the RFV

Compass is compatible with the IAB Eurpoe 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.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]);
    });
}]);