From 6a6473abbddc7b99e9b010512f98b91566927b86 Mon Sep 17 00:00:00 2001 From: Ben Dwyer Date: Thu, 10 Oct 2019 12:06:29 +0100 Subject: [PATCH] use a different tracks implementation on wpcom --- modules/contact-form/tracks-events.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/modules/contact-form/tracks-events.php b/modules/contact-form/tracks-events.php index 228dced137915..3f167edb50052 100644 --- a/modules/contact-form/tracks-events.php +++ b/modules/contact-form/tracks-events.php @@ -9,7 +9,6 @@ use Automattic\Jetpack\Tracking; use Automattic\Jetpack\Status; - /** * Function that sends a `jetpack_contact_form_block_message_sent` event to Tracks * @@ -17,12 +16,22 @@ * @param array $all_values - fields from the default contact form. * @param array $extra_values - extra fields added to from the contact form. - * @return void + * @return null */ function jetpack_tracks_record_grunion_pre_message_sent( $post_id, $all_values, $extra_values ) { $status = new Automattic\Jetpack\Status(); - if ( ! $status->is_development_mode() && isset( $extra_values['is_block'] ) && $extra_values['is_block'] ) { + if ( $status->is_development_mode() ) { + return false; + } + + if ( isset( $extra_values['is_block'] ) && $extra_values['is_block'] ) { + if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) { + require_lib( 'tracks/client' ); + tracks_record_event( $current_user, 'simple_payments_button_' . $event_action, $event_properties ); + return; + } + $tracking = new Automattic\Jetpack\Tracking(); $tracking->tracks_record_event( wp_get_current_user(),