Skip to content

Commit

Permalink
Remove conversion rate data when Popup Analytics is installed
Browse files Browse the repository at this point in the history
We already hide the opens and conversions when analytics is active as the extensions adds its own data to the columns. May change in the future version of the extension.

Issue #775
  • Loading branch information
fpcorso committed Oct 12, 2020
1 parent d64f850 commit c0b465f
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions classes/Admin/Popups.php
Original file line number Diff line number Diff line change
Expand Up @@ -1275,15 +1275,17 @@ public static function render_columns( $column_name, $post_id ) {
}
break;
case 'conversion_rate':
$opens = $popup->get_event_count( 'open' );
$conversions = $popup->get_event_count( 'conversion' );
if ( ! pum_extension_enabled( 'popup-analytics' ) ) {
$opens = $popup->get_event_count( 'open' );
$conversions = $popup->get_event_count( 'conversion' );

if ( $opens > 0 && $opens >= $conversions ) {
$conversion_rate = round( $conversions / $opens * 100, 2 );
} else {
$conversion_rate = 0;
if ( $opens > 0 && $opens >= $conversions ) {
$conversion_rate = round( $conversions / $opens * 100, 2 );
} else {
$conversion_rate = 0;
}
echo esc_html( $conversion_rate . '%' );
}
echo esc_html( $conversion_rate . '%' );
break;
}
}
Expand Down

0 comments on commit c0b465f

Please sign in to comment.