Skip to content

Commit

Permalink
New hosted site: dispatch Tracks event on suggestion fetch click (Aut…
Browse files Browse the repository at this point in the history
  • Loading branch information
zaguiini authored Jun 21, 2023
1 parent 9a88c8b commit a4d4001
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const NewHostedSiteOptions = ( { navigation }: Pick< StepProps, 'navigati

const isSiteTitleEmpty = ! siteTitle || siteTitle.trim().length === 0;
const isFormSubmitDisabled = isSiteTitleEmpty;
const hasChangedInput = useRef( { geoAffinity: false } );
const hasChangedInput = useRef( { title: false, geoAffinity: false } );
const isSmallScreen = useMobileBreakpoint();

const handleSubmit = async ( event: React.FormEvent ) => {
Expand All @@ -87,6 +87,7 @@ export const NewHostedSiteOptions = ( { navigation }: Pick< StepProps, 'navigati
setFormTouched( true );

if ( event.currentTarget.name === 'siteTitle' ) {
hasChangedInput.current.title = true;
return setSiteTitle( event.currentTarget.value );
}
};
Expand Down Expand Up @@ -130,6 +131,11 @@ export const NewHostedSiteOptions = ( { navigation }: Pick< StepProps, 'navigati
} else {
setShouldOverrideSiteTitle( true );
}

recordTracksEvent( 'calypso_signup_site_options_fetch_suggestion_click', {
source: 'site_title',
has_changed_title: hasChangedInput.current.title,
} );
} }
aria-label={ translate( 'Generate a random site name' ) }
>
Expand Down

0 comments on commit a4d4001

Please sign in to comment.