Skip to content

Commit

Permalink
Domain search ab test (Automattic#22224)
Browse files Browse the repository at this point in the history
See p8kIbR-cR-p2 for details.
  • Loading branch information
matthusby authored Feb 8, 2018
1 parent 6dbe02c commit af6ff0a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
5 changes: 4 additions & 1 deletion client/components/domains/domain-search-results/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { currentUserHasFlag } from 'state/current-user/selectors';
import { TRANSFER_IN_NUX } from 'state/current-user/constants';
import { getDesignType } from 'state/signup/steps/design-type/selectors';
import { DESIGN_TYPE_STORE } from 'signup/constants';
import { abtest } from 'lib/abtest';

class DomainSearchResults extends React.Component {
static propTypes = {
Expand Down Expand Up @@ -72,10 +73,12 @@ class DomainSearchResults extends React.Component {
const { MAPPABLE, MAPPED, TLD_NOT_SUPPORTED, TRANSFERRABLE, UNKNOWN } = domainAvailability;

const domain = get( availableDomain, 'domain_name', lastDomainSearched );
const testGroup = abtest( 'domainSuggestionTestV5' );
const showExactMatch = 'group_0' === testGroup;

let availabilityElement, domainSuggestionElement, offer;

if ( availableDomain ) {
if ( availableDomain && showExactMatch ) {
// should use real notice component or custom class
availabilityElement = (
<Notice status="is-success" showDismiss={ false }>
Expand Down
15 changes: 13 additions & 2 deletions client/components/domains/register-domain-step/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,15 @@ import {
} from 'state/domains/suggestions/selectors';
import { composeAnalytics, recordGoogleEvent, recordTracksEvent } from 'state/analytics/actions';
import { TRANSFER_IN_NUX } from 'state/current-user/constants';
import { abtest } from 'lib/abtest';

const domains = wpcom.domains();

// max amount of domain suggestions we should fetch/display
const SUGGESTION_QUANTITY = 10;
const INITIAL_SUGGESTION_QUANTITY = 2;

const searchVendor = 'domainsbot';
let searchVendor = 'domainsbot';
const fetchAlgo = searchVendor + '/v1';

let searchQueue = [];
Expand All @@ -69,6 +70,7 @@ function getQueryObject( props ) {
if ( ! props.selectedSite || ! props.selectedSite.domain ) {
return null;
}

return {
query: props.selectedSite.domain.split( '.' )[ 0 ],
quantity: SUGGESTION_QUANTITY,
Expand Down Expand Up @@ -367,6 +369,10 @@ class RegisterDomainStep extends React.Component {
} );

const timestamp = Date.now();
const testGroup = abtest( 'domainSuggestionTestV5' );
if ( 'group_1' === testGroup || 'group_2' === testGroup || 'group_3' === testGroup ) {
searchVendor = testGroup;
}

async.parallel(
[
Expand Down Expand Up @@ -691,7 +697,12 @@ class RegisterDomainStep extends React.Component {
find( this.state.searchResults, matchesSearchedDomain );
const onAddMapping = domain => this.props.onAddMapping( domain, this.state );

let suggestions = reject( this.state.searchResults, matchesSearchedDomain );
const searchResults = this.state.searchResults || [];
const testGroup = abtest( 'domainSuggestionTestV5' );
let suggestions =
'group_1' === testGroup || 'group_2' === testGroup || 'group_3' === testGroup
? [ ...searchResults ]
: reject( searchResults, matchesSearchedDomain );

if ( this.props.includeWordPressDotCom || this.props.includeDotBlogSubdomain ) {
if ( this.state.loadingSubdomainResults && ! this.state.loadingResults ) {
Expand Down
11 changes: 11 additions & 0 deletions client/lib/abtest/active-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,15 @@ export default {
defaultVariation: 'original',
allowExistingUsers: true,
},
domainSuggestionTestV5: {
datestamp: '20180204',
variations: {
group_0: 1, // Default group
group_1: 1000,
group_2: 1000,
group_3: 1000,
},
defaultVariation: 'group_0',
allowExistingUsers: true,
},
};

0 comments on commit af6ff0a

Please sign in to comment.