Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R2: Updated Enhanced Conversion flow #2361

Open
wants to merge 14 commits into
base: feature/2239-enhanced-conversions-panel
Choose a base branch
from

Conversation

asvinb
Copy link
Collaborator

@asvinb asvinb commented Apr 10, 2024

Changes proposed in this Pull Request:

Closes #2364 .

Replace this with a good description of your changes & reasoning.

Screenshots:

Detailed test instructions:

Additional details:

Changelog entry

@asvinb asvinb requested a review from joemcgill April 10, 2024 08:32
Copy link
Collaborator

@joemcgill joemcgill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@asvinb this is already starting off great. I'm getting the requirements finalized and the biggest change is that we don't want to show the second "Enable" screen from the modal once the user returns from enabling EC in the GAFE. I've left some thoughts inline.

startEnhancedConversionTOSPolling,
stopEnhancedConversionTOSPolling,
};
return polling;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're no longer using any return value from this hook, so this could be removed. Alternately, we could return an object containing the polling status and the return value of acceptedCustomerDataTerms() as a convenience. So components wouldn't need to use this alongside the acceptedCustomerDataTerms() hook, ex:

Suggested change
return polling;
return {
isPolling,
acceptedCustomerDataTerms,
hasFinishedResolution
};

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good! Updated @joemcgill

@@ -0,0 +1,52 @@
/**
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest that this component would be better located with the settings folder since the success modal may go away once promoting EC is no longer a priority, but the settings panel will remain.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment on lines 17 to 20
// We could have used the return value from useAutoCheckEnhancedConversionTOS to know
// if there's polling in progress. However from a UI point of view, it'll be confusing
// for the user when refreshing the page to see a loading spinner while polling is in progress.
// Hence we are showing the spinner only when the user clicks on the Enable button.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that we want to be able to optionally enable polling, I think it might be clearer if we moved all of this state into the useAutoCheckEnhancedConversionTOS() hook, and return a function that allows this consuming component to enable polling when needed. We would probably need to pass an initial polling state to the hook.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice improvement. Updated!

Comment on lines 21 to 31
let title = __(
'Optimize your conversion tracking with Enhanced Conversions',
'google-listings-and-ads'
);

if ( acceptedCustomerDataTerms ) {
title = __(
'Your Enhanced Conversions are almost ready',
'google-listings-and-ads'
);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be written as a const:

Suggested change
let title = __(
'Optimize your conversion tracking with Enhanced Conversions',
'google-listings-and-ads'
);
if ( acceptedCustomerDataTerms ) {
title = __(
'Your Enhanced Conversions are almost ready',
'google-listings-and-ads'
);
}
const title = acceptedCustomerDataTerms
? __(
'Your Enhanced Conversions are almost ready',
'google-listings-and-ads'
)
: __(
'Optimize your conversion tracking with Enhanced Conversions',
'google-listings-and-ads'
);

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

return <AppSpinner />;
}

if ( ! acceptedCustomerDataTerms ) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The copy for this has been updated so that the panel is not as long. See: https://docs.google.com/document/d/1U1Wiymz51aRsUZQKEHit-y9o1kiSdkEcBV-8e3BXJiM/edit#heading=h.27ah3dar1ze0.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated @joemcgill

const ConfirmButton = ( { onConfirm = noop } ) => {
const { updateEnhancedAdsConversionStatus } = useAppDispatch();

const handleConfirm = () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're going to need to move this out to the CTA component and pass it in as part of the onConfirm callback that is passed to this component because the requirements have changed slightly, and we want to automatically confirm that this is enabled once the user has clicked from the T&C modal and returned, without needing to take a second step of also confirming again. This should also work in the settings panel if the user clicks the EnableButton and then returns to the settings page.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@joemcgill joemcgill linked an issue Apr 11, 2024 that may be closed by this pull request
@asvinb
Copy link
Collaborator Author

asvinb commented Apr 16, 2024

@joemcgill PR is ready for another round of review. To know whether we should skip the confirmation screen (because we are using the same components), I added a new property in the data store since we need to use that value in cta.js and index.js. I tried to have it as a state variable but unfortunately the components are rendered differently. Below are screenshots of the different screens within the modal:

Prompt user to enable EC (user has not accepted terms):
image

Confirmation (user has accepted terms but has not enabled EC in the store):
image

Success (after enabling EC):
image

Let me know if you have any questions

Copy link
Collaborator

@joemcgill joemcgill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @asvinb. I started doing a new review but realized that the new success flow is not quite right. When I test the EC modal with T&C set to false, I would expect the following flow:

  1. Show the accept-terms page
  2. Click the accept terms CTA
  3. Visit GAFE to enable EC and accept terms
  4. Return to the modal (now with terms accepted)
  5. Show the success page

Instead, when I returned to the modal from the GAFE, I am shown the confirm page. The confirm page should only be shown if the modal is opened with the terms already accepted. I can see that you're setting the skip confirmation state in the EnableButton, but it doesn't look like that state is ever reaching the data store for some reason.

I left some notes inline, but would be great to double check that this flow is working as expected.

{ __( 'Enable Enhanced Conversions', 'google-listings-and-ads' ) }
</AppButton>
<AppButton
icon={ externalIcon }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✨ perfect icon choice

Comment on lines +171 to +178
if (
acceptedCustomerDataTerms &&
allowEnhancedConversions !==
ENHANCED_ADS_CONVERSION_STATUS.ENABLED &&
! skipConfirmation
) {
return 'confirm';
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic here seems incorrect to me. Seems like there could be a case where you have accepted terms, but not enabled EC, and if the skipConfirmation setting isn't set, you would end up with the accept-terms page. Is that expected?

It may be more clear to do these in the order of loading, accept-terms, confirm, and finally success. That way a simple if ( ! acceptedCustomerDataTerms ) { ... would result in the accept-terms page, and you would only reach success if all other cases get passed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the order as you suggested @joemcgill . Let me know what you think.

updateEnhancedAdsConversionStatus(
ENHANCED_ADS_CONVERSION_STATUS.PENDING
);
updateEnhancedConversionsSkipConfirmation( true );
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only needed for the modal, so probably better to pass this in as part of the onEnable handler from the modal, rather than explicitly setting this here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 The updateEnhancedConversionsSkipConfirmation action has been moved. I've kept updateEnhancedAdsConversionStatus since it's needed when the CTA is rendered within the Settings panel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update Enhanced Conversions onboarding flow
2 participants