ActiveCampaign Event Tracking


Heads up! This functionality is now included in the Event Tracking Addon, which is available for download in your account (for Plus and Professional licenses).

ActiveCampaign includes a feature called Event Tracking which can be used in addition to site tracking to track additional engagement points on your website, for example video plays, course progress, forum activity, etc.

WP Fusion’s ActiveCampaign integration includes a helper function to allow you to track events over the ActiveCampaign events API.

To use event tracking with WP Fusion it must first be enabled in your ActiveCampaign account, at Settings » Tracking » Event Tracking.

These examples work with the full version of WP Fusion as well as WP Fusion Lite.


#Basic example

Events are tracked by making a call to wp_fusion()->crm->track_event(), for example:

wp_fusion()->crm->track_event( 'My event' );

You can also optionally pass an event description:

wp_fusion()->crm->track_event( 'My event', 'Event description' );

#Track LearnDash course progress as events

Tracking data from other plugins can be achieved by calling the track_event function while hooked to other plugins’ actions.

For example to send LearnDash course progress to ActiveCampaign as events:

function wpf_track_learndash_events( $data ) {

	if ( doing_action( 'learndash_course_completed' ) ) {
		$post_id = $data['course']->ID;
	} elseif ( doing_action( 'learndash_lesson_completed' ) ) {
		$post_id = $data['lesson']->ID;
	} elseif ( doing_action( 'learndash_topic_completed' ) ) {
		$post_id = $data['topic']->ID;
	} elseif ( doing_action( 'learndash_quiz_completed' ) ) {
		$post_id = $data['quiz']->ID;

	$last_item = get_post( $post_id );

	// Get the post type label

	$post_type = get_post_type_object( $last_item->post_type );
	$label     = $post_type->labels->singular_name;

	wp_fusion()->crm->track_event( 'Completed ' . $label, $last_item->post_title );

	// Quizzes

	if ( isset( $data['quiz'] ) ) {

		if ( true == $data['pass'] ) {
			wp_fusion()->crm->track_event( 'Passed quiz' );
		} else {
			wp_fusion()->crm->track_event( 'Failed quiz' );


add_action( 'learndash_course_completed', 'wpf_track_learndash_events', 5 );
add_action( 'learndash_lesson_completed', 'wpf_track_learndash_events', 5 );
add_action( 'learndash_quiz_completed', 'wpf_track_learndash_events', 5 );
add_action( 'learndash_topic_completed', 'wpf_track_learndash_events', 5 );

That data then shows up on the student’s contact record in ActiveCampaign like so

Was this helpful?