Skip to content

Commit

Permalink
Remove unused AB test code (#14969)
Browse files Browse the repository at this point in the history
  • Loading branch information
gravityrail authored Mar 13, 2020
1 parent eb891d7 commit fd4e0ae
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 34 deletions.
39 changes: 6 additions & 33 deletions class.jetpack-connection-banner.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ function build_connect_url_for_slide( $jp_version_banner_added ) {
false,
sprintf( 'connect-banner-%s-%s', $jp_version_banner_added, $current_screen->base )
);
// Add a tracks event corresponding to the A/B version displayed
$ab_test = Jetpack_Options::get_option( 'ab_connect_banner_green_bar' );
if ( in_array( $ab_test, array( 'a', 'b' ), true ) ) {
$url = add_query_arg( 'ab_connect_banner_green_bar', $ab_test, $url );
}
return add_query_arg( 'auth_approved', 'true', $url );
}

Expand Down Expand Up @@ -191,33 +186,6 @@ public static function enqueue_connect_button_scripts() {
);
}

/**
* Performs an A/B test showing or hiding the green bar at the top of the connection dialog displayed in Dashboard or Plugins.
* We save which version we're showing so we always show the same to the same user.
* The "A" version displays the green bar at the top.
* The "B" version doesn't display it.
*
* @return void
*/
function get_ab_banner_top_bar() {
$ab_test = Jetpack_Options::get_option( 'ab_connect_banner_green_bar' );
// If it doesn't exist yet, generate it for later use and save it, so we always show the same to this user
if ( ! $ab_test ) {
$ab_test = 1 === rand( 1, 2 ) ? 'a' : 'b';
Jetpack_Options::update_option( 'ab_connect_banner_green_bar', $ab_test );
}
if ( 'a' === $ab_test ) {
?>
<div class="jp-wpcom-connect__container-top-text">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><rect x="0" fill="none" width="24" height="24"/><g><path d="M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2l-.5-6h3l-.5 6z"/></g></svg>
<span>
<?php esc_html_e( 'You’re almost done. Set up Jetpack to enable powerful security and performance tools for WordPress.', 'jetpack' ); ?>
</span>
</div>
<?php
}
}

/**
* Renders the new connection banner as of 4.4.0.
*
Expand All @@ -227,7 +195,12 @@ function get_ab_banner_top_bar() {
function render_banner() {
?>
<div id="message" class="updated jp-wpcom-connect__container">
<?php $this->get_ab_banner_top_bar(); ?>
<div class="jp-wpcom-connect__container-top-text">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><rect x="0" fill="none" width="24" height="24"/><g><path d="M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2l-.5-6h3l-.5 6z"/></g></svg>
<span>
<?php esc_html_e( 'You’re almost done. Set up Jetpack to enable powerful security and performance tools for WordPress.', 'jetpack' ); ?>
</span>
</div>
<div class="jp-wpcom-connect__inner-container">
<span
class="notice-dismiss connection-banner-dismiss"
Expand Down
5 changes: 5 additions & 0 deletions class.jetpack.php
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,11 @@ function plugin_upgrade() {
}
}

// Upgrade to 8.4.0.
if ( Jetpack_Options::get_option( 'ab_connect_banner_green_bar' ) ) {
Jetpack_Options::delete_option( 'ab_connect_banner_green_bar' );
}

if ( did_action( 'wp_loaded' ) ) {
self::upgrade_on_load();
} else {
Expand Down
1 change: 0 additions & 1 deletion packages/options/legacy/class-jetpack-options.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ public static function get_option_names( $type = 'compact' ) {
'safe_mode_confirmed', // (bool) True if someone confirms that this site was correctly put into safe mode automatically after an identity crisis is discovered.
'migrate_for_idc', // (bool) True if someone confirms that this site should migrate stats and subscribers from its previous URL
'dismissed_connection_banner', // (bool) True if the connection banner has been dismissed
'ab_connect_banner_green_bar', // (int) Version displayed of the A/B test for the green bar at the top of the connect banner.
'onboarding', // (string) Auth token to be used in the onboarding connection flow
'tos_agreed', // (bool) Whether or not the TOS for connection has been agreed upon.
'static_asset_cdn_files', // (array) An nested array of files that we can swap out for cdn versions.
Expand Down

0 comments on commit fd4e0ae

Please sign in to comment.