extends Base_Object_With_Meta
Represents an automation funnel. A funnel is a sequence of steps (actions, benchmarks, timers, and logic) that contacts move through. Use this class to inspect funnel configuration, manage its active state, and access its steps.
Methods
| Method | Returns | Description |
|---|---|---|
get_id() | int | Returns the funnel ID. |
get_title() | string | Returns the funnel’s display title. |
get_status() | string | Returns the funnel status: 'active', 'inactive', or 'archived'. |
is_active() | bool | Returns true if the funnel is currently active. |
get_steps( $query = [] ) | Step[] | Returns an array of Step objects in this funnel, optionally filtered by a query array. |
get_step_ids( $query = [] ) | int[] | Returns an array of step IDs. |
get_num_steps() | int | Returns the total number of steps in the funnel. |
get_first_step_id() | int | Returns the ID of the first step. |
get_entry_steps() | Step[] | Returns an array of benchmark (entry) steps. |
get_entry_step_ids() | int[] | Returns an array of benchmark (entry) step IDs. |
get_emails() | Email[] | Returns all Email objects used in email steps within this funnel. |
get_email_steps() | Step[] | Returns all email action steps in this funnel. |
get_conversion_steps() | Step[] | Returns all steps flagged as conversion steps. |
is_active() | bool | Returns true if the funnel is active. |
pause_events() | bool | Pauses all waiting events for contacts in this funnel. |
unpause_events() | bool | Resumes all paused events for contacts in this funnel. |
cancel_events() | bool | Cancels all waiting events for contacts in this funnel. |
has_errors() | bool | Returns true if the funnel has configuration errors. |
export() | array | Returns the funnel as an exportable data array. |
export_url() | string | Returns a URL to download the funnel as a JSON export file. |
import( $data ) | bool | Imports a funnel from an exported data array. |
Usage
Here’s a pseudo code example for a hypothetical funnel reporting integration.
<?php
add_action( 'groundhogg/admin/reports/pages/funnels/after_reports', 'my_plugin_append_funnel_report' );
/**
* Append custom data to a funnel's report page.
*
* @return void
*/
function my_plugin_append_funnel_report() {
$funnel_id = absint( $_GET['funnel'] ?? 0 );
$funnel = new \Groundhogg\Funnel( $funnel_id );
if ( ! $funnel->exists() ) {
return;
}
echo '' . esc_html( $funnel->get_title() ) . ' — My Plugin Stats';
echo 'Steps: ' . $funnel->get_num_steps() . '';
echo 'Status: ' . esc_html( $funnel->get_status() ) . '';
foreach ( $funnel->get_emails() as $email ) {
echo 'Email: ' . esc_html( $email->get_title() ) . '';
}
}
Was this helpful?
Let us know if this document answered your question. That’s the only way we can improve.
