mb_substr( preg_replace( '/[^a-z0-9_]/', '', strtolower( sanitize_text_field( wp_unslash( $_POST['name'] ?? '' ) ) ) ), 0, 100 ), 'trigger' => in_array( $trigger, array( 'click', 'submit', 'pageview' ), true ) ? $trigger : 'click', 'selector' => sanitize_text_field( wp_unslash( $_POST['selector'] ?? '' ) ), 'match' => 'equals' === sanitize_key( wp_unslash( $_POST['match'] ?? '' ) ) ? 'equals' : 'contains', 'label_from' => in_array( $label_from, array( 'fixed', 'text', 'href', 'none' ), true ) ? $label_from : 'none', 'label' => sanitize_text_field( wp_unslash( $_POST['label'] ?? '' ) ), 'value' => is_numeric( $value ) ? (float) $value : null, 'enabled' => true, ); if ( '' === $rule['name'] || '' === $rule['selector'] ) { $error = 'Event name and selector (or URL) are required.'; } else { if ( null !== $index && isset( $rules[ $index ] ) ) { $rule['enabled'] = $rules[ $index ]['enabled']; $rules[ $index ] = $rule; } else { $rules[] = $rule; } update_option( 'footloom_event_rules', $rules ); } } elseif ( 'toggle_rule' === $action && isset( $rules[ $index ] ) ) { $rules[ $index ]['enabled'] = empty( $rules[ $index ]['enabled'] ); update_option( 'footloom_event_rules', $rules ); } elseif ( 'delete_rule' === $action && isset( $rules[ $index ] ) ) { unset( $rules[ $index ] ); $rules = array_values( $rules ); update_option( 'footloom_event_rules', $rules ); } if ( $error ) { echo '

' . esc_html( $error ) . '

'; } else { echo '

Saved.

'; } } // How many times each event fired in the last 7 days, to check a rule is working. // phpcs:disable WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery, PluginCheck.Security.DirectDB.UnescapedDBParameter -- Plugin's own table, name from Plugin::table(). $counts = $wpdb->get_results( $wpdb->prepare( 'SELECT name, COUNT(*) AS n FROM ' . Plugin::table( 'events' ) . ' WHERE created_at > %s GROUP BY name', gmdate( 'Y-m-d H:i:s', time() - 7 * DAY_IN_SECONDS ) ), OBJECT_K ); // phpcs:enable $edit_index = isset( $_GET['edit'] ) && isset( $rules[ absint( $_GET['edit'] ) ] ) ? absint( $_GET['edit'] ) : null; $form = null !== $edit_index ? $rules[ $edit_index ] : array( 'name' => '', 'trigger' => 'click', 'selector' => '', 'match' => 'contains', 'label_from' => 'text', 'label' => '', 'value' => null, ); $triggers = array( 'click' => 'Click on an element', 'submit' => 'Form submission', 'pageview' => 'Page visit', ); $page_url = admin_url( 'admin.php?page=footloom-events' ); ?>

Track clicks, form submissions and page visits without writing code. Events show up on the dashboard and can be used as goals.

Your events

No custom events yet. Add your first one below.

$rule ) : ?>
Event nameTriggerSelector or URLLast 7 daysStatus
n : 0; ?>
Edit


Lowercase letters, numbers and underscores.


Which element to watch, for example #signup-button, .hero .button or a[href$=".pdf"]. In your browser, right click the element and choose Inspect to find its id or class. For example /thank-you.


A number to add up in reports, for example the price of a product.

Cancel

For developers

Send an event from your own JavaScript:

footloom.track('signup', { label: 'footer form', value: 1 });

Or add attributes to any element to track clicks on it:

<a href="/pricing.pdf" data-footloom-event="download" data-footloom-label="pricing.pdf">Download</a>

Link clicks to other websites (outbound_click) and form submissions (form_submit) are tracked automatically.