# Conversions

In Compass, the conversion is a flexible concept that adapts to your own goals. A conversion can be a newsletter subscription, a user creation, a paywall sign up... You're the one who decides which events are worthy of tracking for conversions.

We recommend you always track the readers' conversion to your paying subscription if your offer one.

To do so, add the following line of JavaScript where a new subscription happens:

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

# Different conversions

You can track other conversions with the same key and a different name, such as:

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

# Automatic conversion tracking

If you want, you can mark certain elements to let Compass do the hard work and automatically track them.

To do so, you just need to add the attribute data-mrf-conversion="nameOfTheConversion". 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" />
  • 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.

# Recirculation

Recirculation modules may be worth tracking as well, you can track some modules of your site (rendering, focus...), its links and its related navigation.

In order to track the recirculation modules, there are two options:

you can add the data-mrf-recirculation attribute to a module containing a link

	<div data-mrf-recirculation="module-name">
		<!-- ... -->
		<a href="link">...</a>
		<!-- ... -->
	</div>

or, without modifying the page templating, use the SDK

	window.marfeel.cmd.push(['compass', function(compass) {
		compass.setRecirculationModules([
			{ selector: '.module1', name: 'module1' },
			{ selector: '.module2', name: 'module2' },
		]);
	}]);

for Hubspot in order to track the redirection URL, it must be configured via API:

	window.marfeel.cmd.push(['compass', function(compass) {
		compass.setRecirculationModules([
			{
				selector: '.module1',
				name: 'module1',
				urlAttribute: 'cta_dest_link'
			}
		]);
	}]);