Skip to content

Commit

Permalink
use a different tracks implementation on wpcom
Browse files Browse the repository at this point in the history
  • Loading branch information
scruffian authored and jeherve committed Oct 11, 2019
1 parent 39f25f6 commit 6a6473a
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions modules/contact-form/tracks-events.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,29 @@
use Automattic\Jetpack\Tracking;
use Automattic\Jetpack\Status;


/**
* Function that sends a `jetpack_contact_form_block_message_sent` event to Tracks
*
* @param int $post_id - the post_id for the CPT that is created.
* @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(),
Expand Down

0 comments on commit 6a6473a

Please sign in to comment.