Skip to content

Commit

Permalink
Track events: Fix tracking property when transferring domains (#95214)
Browse files Browse the repository at this point in the history
* Track event when using own domain

* Fix tracking property on start

* Improve variable definition
  • Loading branch information
renancarvalho authored Oct 8, 2024
1 parent 5206710 commit f13628c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
1 change: 1 addition & 0 deletions client/landing/stepper/declarative-flow/onboarding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ const onboarding: Flow = {
setRedirectedToUseMyDomain( false );
return navigate( 'plans' );
case 'use-my-domain':
setSignupDomainOrigin( SIGNUP_DOMAIN_ORIGIN.USE_YOUR_DOMAIN );
if ( providedDependencies?.mode && providedDependencies?.domain ) {
return navigate(
`use-my-domain?step=${ providedDependencies.mode }&initialQuery=${ providedDependencies.domain }`
Expand Down
14 changes: 13 additions & 1 deletion client/landing/stepper/hooks/use-record-signup-complete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,18 @@ export const useRecordSignupComplete = ( flow: string | null ) => {
true
);
},
[ domainCartItem, flow, planCartItem, selectedDomain, siteCount, siteId, theme ]
[
domainCartItem,
flow,
isNewUser,
isNewishUser,
planCartItem,
selectedDomain,
signupDomainOrigin,
site?.slug,
siteCount,
siteId,
theme,
]
);
};
12 changes: 9 additions & 3 deletions client/signup/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,12 @@ class Signup extends Component {
// but it's not recommended outside of this, hence the name toStepper. See Automattic/growth-foundations#72 for more context.
if ( ! dependencies.toStepper ) {
debug( 'Tracking signup completion.', debugProps );
const isMapping = domainItem && isDomainMapping( domainItem );
const isTransfer = domainItem && isDomainTransfer( domainItem );
const signupDomainOriginValue =
isTransfer || isMapping
? SIGNUP_DOMAIN_ORIGIN.USE_YOUR_DOMAIN
: signupDomainOrigin ?? SIGNUP_DOMAIN_ORIGIN.NOT_SET;

recordSignupComplete( {
flow: this.props.flowName,
Expand All @@ -582,9 +588,9 @@ class Signup extends Component {
intent,
startingPoint,
isBlankCanvas: isBlankCanvasDesign( dependencies.selectedDesign ),
isMapping: domainItem && isDomainMapping( domainItem ),
isTransfer: domainItem && isDomainTransfer( domainItem ),
signupDomainOrigin: signupDomainOrigin ?? SIGNUP_DOMAIN_ORIGIN.NOT_SET,
isMapping: isMapping,
isTransfer: isTransfer,
signupDomainOrigin: signupDomainOriginValue,
} );
}
};
Expand Down

0 comments on commit f13628c

Please sign in to comment.