LifterLMS H5P: Add Interactive Content and Track Completion

How to add H5P interactive videos, drag and drop tasks and branching scenarios to LifterLMS lessons, and three ways to connect H5P results to lesson completion, including a tested code pattern.

  • Add as a preferred source on Google
Illustration for “LifterLMS H5P: Add Interactive Content and Track Completion”

H5P lets you build interactive content without coding: interactive videos with questions inside them, drag and drop exercises, flashcards, branching scenarios, image hotspots and dozens more. It is free, open source and runs as a WordPress plugin, which makes it a natural partner for LifterLMS lessons.

The catch is that LifterLMS and H5P do not talk to each other out of the box. You can embed H5P in a lesson in minutes, but LifterLMS will not know whether the student finished or passed it. This guide shows how to add H5P to LifterLMS lessons and the three ways to connect H5P results to lesson completion, from no code to a small custom plugin.

It is for instructional designers and course creators who want richer lessons, and for developers asked to make "the lesson completes when the activity is passed" work.

When H5P beats a LifterLMS quiz

LifterLMS has a capable quiz engine, and with the Advanced Quizzes add-on it covers many question types. Quizzes are graded, stored in the student's record, appear in reporting and can be required to pass a lesson. Use them for assessments that count.

H5P is better for practice and engagement inside the lesson:

  • Interactive Video: questions and hotspots at points in a video, so students cannot just let it play.
  • Branching Scenario: choose-your-path simulations for soft skills, sales or compliance.
  • Drag and Drop, Image Hotspots, Mark the Words: quick checks of understanding.
  • Course Presentation and Flashcards: self-study and revision.

A good pattern is H5P for learning activities within lessons and LifterLMS quizzes for the graded check at the end of each module. Our guide on creating quizzes in LifterLMS covers the assessment side.

Mobile and accessibility

Most H5P content types are responsive, but not all are equally pleasant on a phone. Drag and drop tasks with small targets and long course presentations are hard to use on a small screen. Check your analytics for the share of students on mobile and test each activity there. H5P publishes accessibility information for its content types; if your organization has accessibility requirements, choose types documented as accessible and add a text alternative where an activity relies on images or audio.

Add H5P content to a LifterLMS lesson

  1. Install the free H5P plugin from WordPress.org and activate it.
  2. Go to H5P Content > Add New. Choose a content type (the H5P Hub downloads it the first time), build the activity and save.
  3. Copy its shortcode, for example [h5p id="12"], from the H5P content list.
  4. Edit your lesson and add the shortcode to the content with a Shortcode block, or in the classic editor.
  5. Preview as a student: log in with a test account enrolled in the course.

Because the activity sits in lesson content, only enrolled students can use it, unless you mark the lesson as a Free Lesson. If you use LifterLMS focus mode, test it there as well, and keep LifterLMS up to date; version 10.2.1 fixed interactive blocks not working in focus mode.

Turn on result tracking in H5P

In the H5P plugin settings, enable Log results for signed in users under User Results. H5P then stores each logged-in user's score in its own h5p_results database table when they finish an activity. You can also enable Save Content State so students can resume long activities. Everything in the next sections depends on result logging.

Three ways to connect H5P to lesson completion

ApproachEffortWhat LifterLMS knowsBest for
Embed onlyMinutesNothing; student clicks Mark CompletePractice activities
Minimum timeMinutesTime spent on the lessonMaking sure students do not skip
xAPI with GrassBladeHours, paid pluginsCompletion and score, plus an LRSOrganizations already using xAPI or SCORM
Small custom pluginA day of developmentPass or fail per activity; lesson completes on pass"Pass the activity to complete the lesson"

1. Embed only

For practice activities this is enough. The student works through the H5P task and clicks Mark Complete. Add a line above the button such as "Finish the activity above before you continue."

2. Minimum time on the lesson

Since version 10.1, LifterLMS can require a minimum time on a lesson. Turn on Enable Minimum Time in the lesson settings and set hours, minutes and seconds; Mark Complete stays unavailable until the time is reached. It does not prove the activity was passed, but it stops students clicking through. See LifterLMS lesson time tracking.

3. xAPI with GrassBlade

The free "Experience API for LifterLMS" plugin by Next Software Solutions works with their paid GrassBlade xAPI Companion plugin. It supports H5P among other content types, can complete a lesson when the xAPI content is completed, and can restrict progress until then. Detailed results go to a Learning Record Store (GrassBlade's LRS or another). It is the right route when you also need SCORM or xAPI packages; our guide to SCORM and xAPI with LifterLMS covers it.

A custom plugin: complete the lesson when the activity is passed

When you want "pass this H5P activity to complete the lesson" without an LRS, a small plugin joins the two systems. It uses three real hooks:

  • h5p_alter_user_result, an action in the H5P plugin that fires when a result is saved, with the score data, the result ID, the content ID and the user ID.
  • llms_trigger_lesson_completion, the LifterLMS action that completes a lesson through the normal checks, including quizzes and minimum time.
  • llms_allow_lesson_completion, the LifterLMS filter that decides whether a lesson may be completed.
<?php
/**
 * Map H5P content IDs to LifterLMS lesson IDs and the score needed to pass.
 */
function llmsx_h5p_map() {
	return array(
		12 => array( 'lesson' => 345, 'pass' => 0.8 ), // 80% on H5P item 12 completes lesson 345.
	);
}

function llmsx_h5p_for_lesson( $lesson_id ) {
	foreach ( llmsx_h5p_map() as $content_id => $rule ) {
		if ( (int) $rule['lesson'] === (int) $lesson_id ) {
			return (int) $content_id;
		}
	}
	return 0;
}

// 1. Record a pass when H5P saves a result, then try to complete the lesson.
add_action( 'h5p_alter_user_result', 'llmsx_h5p_result_saved', 10, 4 );
function llmsx_h5p_result_saved( $data, $result_id, $content_id, $user_id ) {
	$map = llmsx_h5p_map();
	if ( empty( $map[ $content_id ] ) || ! $user_id || empty( $data['max_score'] ) ) {
		return;
	}

	$rule = $map[ $content_id ];
	if ( ( $data['score'] / $data['max_score'] ) < $rule['pass'] ) {
		return;
	}

	update_user_meta( $user_id, '_llmsx_h5p_passed_' . $content_id, time() );

	if ( ! llms_is_complete( $user_id, $rule['lesson'], 'lesson' ) ) {
		do_action( 'llms_trigger_lesson_completion', $user_id, $rule['lesson'], 'h5p_' . $content_id );
	}
}

// 2. Block manual completion until the activity has been passed.
add_filter( 'llms_allow_lesson_completion', 'llmsx_h5p_require_pass', 20, 4 );
function llmsx_h5p_require_pass( $allow, $user_id, $lesson_id, $trigger ) {
	$content_id = llmsx_h5p_for_lesson( $lesson_id );
	if ( ! $allow || ! $content_id || 0 === strpos( (string) $trigger, 'admin_' ) ) {
		return $allow;
	}
	return (bool) get_user_meta( $user_id, '_llmsx_h5p_passed_' . $content_id, true );
}

// 3. Hide the Mark Complete button until then.
add_filter( 'llms_show_mark_complete_button', 'llmsx_h5p_hide_button', 10, 2 );
function llmsx_h5p_hide_button( $show, $lesson ) {
	$content_id = llmsx_h5p_for_lesson( $lesson->get( 'id' ) );
	if ( $show && $content_id ) {
		$show = (bool) get_user_meta( get_current_user_id(), '_llmsx_h5p_passed_' . $content_id, true );
	}
	return $show;
}

How it behaves

  • H5P saves results by AJAX, so the lesson completes in the background. The student sees it as complete on the next page load; add a note such as "When you pass the activity, reload the page to continue."
  • Admins can still mark the lesson complete from reporting, because admin triggers start with admin_ and are let through.
  • Because completion runs through llms_trigger_lesson_completion, LifterLMS's quiz and minimum time rules still apply, and engagements, webhooks and course completion fire as normal.
  • For many lessons, replace the hard-coded map with a lesson setting, so course authors can choose the H5P item and pass mark themselves.

Test it on staging with a student account, and confirm that H5P result logging is on, or nothing will fire. Our hooks and filters guide explains where to put code like this so updates do not remove it.

Common mistakes and troubleshooting

  • Nothing happens on completion. Result logging is off in H5P settings, or the student is not logged in. H5P only logs results for signed-in users.
  • Score never reaches the pass mark. Some content types report no score or a max score of zero. Check the h5p_results table or H5P's results screen for what the activity actually reports.
  • Activity shows but is blank in focus mode. Update LifterLMS and check your caching and script-optimization plugins, which often break H5P iframes.
  • Expecting H5P scores in LifterLMS gradebook. They are not stored as LifterLMS quiz grades. If a score must count toward a course grade, use a LifterLMS quiz.
  • Huge activities. Long interactive videos with many questions frustrate students on mobile. Keep each activity focused.

Frequently asked questions

Does LifterLMS support H5P?

You can embed H5P in any lesson with the H5P plugin's shortcode. Linking H5P results to LifterLMS completion needs an xAPI plugin such as GrassBlade, or a small custom plugin.

Is H5P free?

The H5P WordPress plugin and its content types are free and open source.

Can H5P replace LifterLMS quizzes?

For practice, yes. For graded assessments that should appear in LifterLMS reporting and grades, use LifterLMS quizzes.

Do I need an LRS for H5P?

Not with the custom plugin approach, which uses H5P's own results table. You need an LRS for the xAPI route.

Next steps

Start with one interactive video in a high-drop-off lesson and see whether completion improves. If students skip it, add minimum time. If passing the activity must gate progress, use the custom approach above or the xAPI route.

We build lesson-level integrations like this, with author-friendly settings so you are not editing code for each lesson. See our LifterLMS plugin development service or tell us which activities you want to track.

References: the H5P plugin on WordPress.org and Experience API for LifterLMS.

Add LifterLMS Expert to your preferred sources

Add lifterlmsexpert.com as a preferred source on Google, or open this article in your AI assistant to use it as a source.

  • Add as a preferred source on Google
Free consultation

Prefer expert help over DIY?

Skip the trial and error. Get specialist LifterLMS help and ship faster.

Talk to a LifterLMS Expert Explore our services

Replies within one business day