Skip to content
Login Contact

Marfeel cookies for sharing data across subdomains

The Marfeel Javascript SDK sets two first-party cookies on the publisher domain. The first cookie stores user information including the unique user identifier, the registered user id when provided, the first visit time, the previous visit time, and the original referrer. The second is a temporal cookie that stores session information such as visit start time, referrer domain, and landing page. Read more about first and third party cookies used by Marfeel.

By default, user information is tracked at the root-domain level and shared across all subdomains. A user visiting domain.com and sub.domain.com is considered the same user, sharing all data points like the RFV.

You can change this default behavior by specifying the domain in the cookieDomain property of the configuration object:

<script type="text/javascript">
function e(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],c=document.createElement("script");c.src=e,t?c.type="module":(c.async=!0,c.type="text/javascript",c.setAttribute("nomodule",""));var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(c,n)}function t(t,c,n){var a,o,r;null!==(a=t.marfeel)&&void 0!==a||(t.marfeel={}),null!==(o=(r=t.marfeel).cmd)&&void 0!==o||(r.cmd=[]),t.marfeel.config=n,t.marfeel.config.accountId=c;var i="https://sdk.mrf.io/statics";e("".concat(i,"/marfeel-sdk.js?id=").concat(c),!0),e("".concat(i,"/marfeel-sdk.es5.js?id=").concat(c),!1)}!function(e,c){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t(e,c,n)}(window,
/* AccountId */, {cookieDomain:'www.mywebsite.com'} /* Config */);
</script>
  1. All domains tracked under the same AccountId share userId when third-party cookies are available.
  2. When cookieDomain specifies a subdomain (e.g., en.mywebsite.com), data is not shared with sibling domains like www.mywebsite.com, it.mywebsite.com, or the root domain (mywebsite.com).
  3. When cookieDomain specifies a root domain (e.g., mywebsite.com), data is shared among all its subdomains (such as www.mywebsite.com or campaign.mywebsite.com). This is the default behavior.
Section titled “Sharing user cookie and session when third-party cookies are not available”

Some browsers do not support third-party cookies or sandbox their usage, even though Marfeel will use them when the browser and consent allow.

Marfeel provides a method to share user and session information via URL parameters when third-party cookies are unavailable.

Obtain the user cookie through getUserId() and session information through getSessionId(), then pass them as query parameters in the URL as mrf_u and mrf_s:

window.marfeel.cmd.push(['compass', async(compass) => {
const mrf_user = await compass.getUserId().userIdPromise;
}]);
window.marfeel.cmd.push(['compass', (compass) => {
const mrf_session = compass.getSessionId();
}]);
How does Marfeel share user data across subdomains by default?

By default, the Marfeel SDK tracks user information at the root-domain level and shares it across all subdomains. A user visiting domain.com and sub.domain.com is considered the same user, sharing all data points like the RFV.

How do you restrict cookie scope to a specific subdomain?

Set the cookieDomain property in the SDK configuration object to a specific subdomain (e.g., en.mywebsite.com). When cookieDomain specifies a subdomain, data is not shared with sibling domains or the root domain.

How can you share user and session cookies when third-party cookies are unavailable?

Use the getUserId() and getSessionId() SDK methods to obtain user and session identifiers, then pass them as URL parameters (mrf_u and mrf_s) when linking between domains.