Conversion and Subscriptions tracking

Marfeel allows tracking goals and conversions like subscribing to a newsletter, signing up to the site, playing a video or subscribing to a paywall. When you track a conversion Marfeel automatically infers the context and calculates different attribution models.

Subscriptions

To track a new subscription invoke the trackConversion method:

window.marfeel = window.marfeel || { cmd: [] };
window.marfeel.cmd.push(['compass', function(compass) {
	compass.trackConversion('subscribe');
}]);

Registrations & generic goal tracking

You can track different conversions providing different conversion names.

window.marfeel.cmd.push(['compass', function(compass) {
	compass.trackConversion('Newsletter Elections');
}]);
window.marfeel.cmd.push(['compass', function(compass) {
	compass.trackConversion('signup');
}]);

Automatic conversion tracking

Marfeel can automatically track conversions when:

  • A user clicks on a <button> or <a > element
  • A user submits a <form>
  • For button and a elements, Compass will register a conversion when a click is triggered.
  • For form element, Compass will register a conversion when a submit is triggered.

To do so add the attribute data-mrf-conversion="nameOfTheConversion" to the element you want Marfeel to track. Example:

<form data-mrf-conversion="newsletterSubscription">
	<input type="submit" value="Submit" />
</form>

<a href="/last-news" data-mrf-conversion="lastNews-header" />

<button class="btn btn-big icon–like" data-mrf-conversion="likeButton" />

Conversion parameters

Conversion parameters are structured data points attached to a conversion that describe what exactly happened during a user interaction. They add context to conversions by capturing the specific details behind an action, turning a generic event into an analyzable signal.

By using conversion parameters, you can measure behavior with precision: which video was watched, which button drove the conversion or which product was added to cart. This granularity is what makes conversions explainable, comparable, and optimizable.

You can add a conversion parameter using the meta parameter to send additional contextual information as key–value pairs when tracking a conversion.

window.marfeel.cmd.push(['compass', function(compass) {
	compass.trackConversion('Newsletter Elections', {
		meta: {
			template: 'A',
			position: 'header'
		}, 
		value : 123
	});
}]);

The conversion above includes two conversion parameters:

  • template describes the template used
  • position indicates where it was added

Conversion parameters vs. dimensions and metrics

Conversion parameters are used to gather data from a website or app.

The data from conversion parameters feeds into dimensions and metrics. These dimensions and metrics are available in reports, explorations, and other surfaces throughout Marfeel so you can analyze the data.

Deduplication & Conversion Options

By default, every call to trackConversion fires a new conversion — including on page reloads and repeated GTM triggers. To control this behaviour, pass a ConversionOptions object as the second argument.

Syntax

window.marfeel = window.marfeel || { cmd: [] };
window.marfeel.cmd.push(['compass', function(compass) {
    compass.trackConversion('subscribe', {
        scope: 'user',
        id: 'optional-explicit-id'
    });
}]);

Parameters

Parameter Type Required Description
scope ‘none’ ‘page’ ‘session’ ‘user’ No Controls deduplication. Defaults to ‘none’ (no dedup).
id string No Explicit deduplication key. Overrides the ID derived from scope.

Scope behaviour

Scope Behaviour
none (default) No deduplication — fires on every call, including page reloads
page Tracked at most once per page load
session Tracked at most once per session
user Tracked at most once per user, persisted across sessions in localStorage
Note:
If no `scope` or `id` is provided, every call to `trackConversion` will be recorded as a new conversion. This includes cases where the pixel is triggered on page reload or by repeated GTM tag executions. Set `scope: 'session'` or `scope: 'user'` to avoid counting the same conversion multiple times.

Using an explicit id

If you already have a unique identifier for the conversion (e.g. a transaction ID or subscription ID from your backend), you can pass it directly via id. This takes precedence over scope:

compass.trackConversion('subscribe', {
    id: 'txn-abc123',
    value: 9.99
});

Legacy syntax

Passing a plain string as the second argument is still supported and is treated as the initiator:

// Legacy — equivalent to { initiator: 'cta-banner' }
compass.trackConversion('subscribe', 'cta-banner');

GTM implementation notes

When the Marfeel SDK is loaded via Google Tag Manager rather than hardcoded on the page, a race condition can occur where the conversion tag fires before the SDK has initialised. The window.marfeel.cmd queue prevents this: calls pushed to the queue are executed once the SDK is ready.

Always wrap conversion calls in the queue pattern, regardless of load order:

window.marfeel = window.marfeel || { cmd: [] };
window.marfeel.cmd.push(['compass', function(compass) {
    compass.trackConversion('subscribe', { scope: 'session' });
}]);

Do not call compass.trackConversion() directly outside of cmd.push when using GTM, as the SDK may not yet be available.