Mautic Points

#Overview

Mautic has a built-in lead scoring system called points. While WP Fusion doesn’t have a visual interface for assigning points, it’s pretty easy to do so with a short snippet of custom code.

#Examples

#Add ten points when a form is submitted

This example runs on the wpf_forms_post_submission hook and adds 10 points to a contact in Mautic after WP Fusion has synced it to Mautic from one of our supported form integrations.

function add_points_in_mautic( $update_data, $user_id, $contact_id, $form_id ) {

	$points = 10;

	wp_remote_post(
		wp_fusion()->crm->url . "api/contacts/{$contact_id}/plus/{$points}",
		wp_fusion()->crm->get_params()
	);

}

add_action( 'wpf_forms_post_submission', 'add_points_in_mautic', 10, 4 );

#Add 50 points when an order is placed

By changing the hook to wpf_woocommerce_payment_complete, we can likewise assign 50 points after an order has been placed.

function add_points_in_mautic( $order_id, $contact_id ) {

	$points = 50;

	wp_remote_post(
		wp_fusion()->crm->url . "api/contacts/{$contact_id}/plus/{$points}",
		wp_fusion()->crm->get_params()
	);

}

add_action( 'wpf_woocommerce_payment_complete', 'add_points_in_mautic', 10, 2 );

Was this helpful?