-
Notifications
You must be signed in to change notification settings - Fork 21
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
Show promo for setting up Google Ads on the product feed tabs #2539 #2641
Show promo for setting up Google Ads on the product feed tabs #2539 #2641
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feature/2460-google-ads-value-prop #2641 +/- ##
=======================================================================
- Coverage 65.1% 63.5% -1.6%
=======================================================================
Files 800 331 -469
Lines 24300 5214 -19086
Branches 1244 1273 +29
=======================================================================
- Hits 15831 3313 -12518
+ Misses 8287 1723 -6564
+ Partials 182 178 -4
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kt-12 I think I figured out some of the E2E issues and pushed a couple of commits. I've left a few other bits of feedback inline.
js/src/product-feed/product-statistics/create-campaign-notice.js
Outdated
Show resolved
Hide resolved
js/src/product-feed/product-statistics/create-campaign-notice.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kt-12 I left a couple of comments. Can you kindly check them out please? Also, the unit tests are failing. Can you take a look?
js/src/product-feed/product-statistics/create-campaign-notice.js
Outdated
Show resolved
Hide resolved
js/src/product-feed/product-statistics/create-campaign-notice.js
Outdated
Show resolved
Hide resolved
js/src/product-feed/product-statistics/create-campaign-notice.js
Outdated
Show resolved
Hide resolved
…rce/google-listings-and-ads into feature/2539-show-promo
QA/Test Report- ✅Testing Environment -
Test Results - When No Paid Campaign available - When Paid Campaign Available - Paid campaign creation flow from Notice button: Recording.914.mp4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Further more this ticket address a bug in
useAdsCampaign
#2539 (comment), [...]
There is an existing issue with
useAdsCampaigns
that was discovered in #2242 (comment), where the hook will not fetch existing Ads accounts in certain circumstances.
I wouldn't consider it's a bug. Please refer to #2242 (comment). In terms of the requirement, does useAdsCampaigns
need to be changed?
In addition, the e2e testing couldn't pass: https://github.com/woocommerce/google-listings-and-ads/actions/runs/11477389417/job/31942026350
js/src/product-feed/product-statistics/create-campaign-notice/index.js
Outdated
Show resolved
Hide resolved
js/src/product-feed/product-statistics/create-campaign-notice/index.js
Outdated
Show resolved
Hide resolved
js/src/product-feed/product-statistics/create-campaign-notice/index.js
Outdated
Show resolved
Hide resolved
js/src/product-feed/product-statistics/create-campaign-notice/index.scss
Outdated
Show resolved
Hide resolved
@eason9487 thanks for the review, we're working through the feedback. Regarding this:
I do think that The purpose of this issue is to encourage merchants to create their first campaign but only if they have approved products and do not already have any ads campaigns created. To verify whether ads campaigns are running we need to check for existing campaigns on the account, which is what this hook seems to be for. However, if someone connects an existing account that already has ads and finishes onboarding by skipping creating a new ad, then the request to see if the account already has ads will never run. This can be verified by connecting an account and creating a campaign. Then from the settings screen, disconnect the account and reconnect it through the setup-ads flow and close without creating a new campaign. At this point, no more campaigns will show on the dashboard because no ads will be returned from the This does not seem like expected behavior to me. |
Hi @joemcgill
Other side effects from changing For example, the campaign list is displayed on the Dashboard page, but the Performance card on the same page still doesn't show campaign performance data. It's also possible that a merchant has connected to a Google Ads account with existing campaigns but has not completed the Ads Setup flow for a long time. The |
That makes sense. I've reviewed the codebase and am documenting my observations here for posterity. It looks like all of the functionality that depends on the The only way that global is getting set is firing the This means that as far as the plugin is concerned, you're not able to see and manage campaigns until you've created a new campaign after connecting the account (even if you reconnect an account you were previously using). That limitation should probably be resolved, IMO, but that is well beyond the scope of what we're trying to solve here or in #2538. So for consistency, I think we'll keep I can log a new issue for the broader updates that we can look at coming back to. |
* | ||
* @return {Promise<void>} | ||
*/ | ||
async mockAdsSetupComplete() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eason9487 useAdsCampaigns
mainly relies on the value of adsSetupComplete
to make a campaign query. I tried using mockCampaignCreationAndAdsSetupCompletion
on this page, but it didn't work here. Finally, I went ahead modifying the global as soon as it was available.
Let me know if there is a better approach here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A more suitable solution is to set ADS_SETUP_COMPLETED_AT
by referring to the way of setting MC_SETUP_COMPLETED_AT
:
google-listings-and-ads/tests/e2e/test-data/test-data.php
Lines 38 to 53 in 65972ac
register_rest_route( 'wc/v3', 'gla-test/onboarded-merchant', [ [ 'methods' => 'POST', 'callback' => __NAMESPACE__ . '\set_onboarded_merchant', 'permission_callback' => __NAMESPACE__ . '\permissions', ], [ 'methods' => 'DELETE', 'callback' => __NAMESPACE__ . '\clear_onboarded_merchant', 'permission_callback' => __NAMESPACE__ . '\permissions', ], ], ); google-listings-and-ads/tests/e2e/test-data/test-data.php
Lines 72 to 101 in 65972ac
/** * Set the onboarded merchant options. */ function set_onboarded_merchant() { /** @var OptionsInterface $options */ $options = woogle_get_container()->get( OptionsInterface::class ); $options->update( OptionsInterface::REDIRECT_TO_ONBOARDING, 'no' ); $options->update( OptionsInterface::MC_SETUP_COMPLETED_AT, 1693215209 ); $options->update( OptionsInterface::GOOGLE_CONNECTED, true ); } /** * Clear a previously set onboarded merchant. */ function clear_onboarded_merchant() { /** @var OptionsInterface $options */ $options = woogle_get_container()->get( OptionsInterface::class ); $options->delete( OptionsInterface::REDIRECT_TO_ONBOARDING ); $options->delete( OptionsInterface::MC_SETUP_COMPLETED_AT ); $options->delete( OptionsInterface::GOOGLE_CONNECTED ); } google-listings-and-ads/tests/e2e/utils/api.js
Lines 102 to 114 in 65972ac
/** * Set Onboarded Merchant. */ export async function setOnboardedMerchant() { await api().post( 'gla-test/onboarded-merchant' ); } /** * Clear Onboarded Merchant. */ export async function clearOnboardedMerchant() { await api().delete( 'gla-test/onboarded-merchant' ); }
After then, use them like this test file, and make sure to clear it in the test.afterAll
block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done this way.
js/src/product-feed/product-statistics/create-campaign-notice/index.scss
Outdated
Show resolved
Hide resolved
* | ||
* @return {Promise<void>} | ||
*/ | ||
async mockAdsSetupComplete() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A more suitable solution is to set ADS_SETUP_COMPLETED_AT
by referring to the way of setting MC_SETUP_COMPLETED_AT
:
google-listings-and-ads/tests/e2e/test-data/test-data.php
Lines 38 to 53 in 65972ac
register_rest_route( 'wc/v3', 'gla-test/onboarded-merchant', [ [ 'methods' => 'POST', 'callback' => __NAMESPACE__ . '\set_onboarded_merchant', 'permission_callback' => __NAMESPACE__ . '\permissions', ], [ 'methods' => 'DELETE', 'callback' => __NAMESPACE__ . '\clear_onboarded_merchant', 'permission_callback' => __NAMESPACE__ . '\permissions', ], ], ); google-listings-and-ads/tests/e2e/test-data/test-data.php
Lines 72 to 101 in 65972ac
/** * Set the onboarded merchant options. */ function set_onboarded_merchant() { /** @var OptionsInterface $options */ $options = woogle_get_container()->get( OptionsInterface::class ); $options->update( OptionsInterface::REDIRECT_TO_ONBOARDING, 'no' ); $options->update( OptionsInterface::MC_SETUP_COMPLETED_AT, 1693215209 ); $options->update( OptionsInterface::GOOGLE_CONNECTED, true ); } /** * Clear a previously set onboarded merchant. */ function clear_onboarded_merchant() { /** @var OptionsInterface $options */ $options = woogle_get_container()->get( OptionsInterface::class ); $options->delete( OptionsInterface::REDIRECT_TO_ONBOARDING ); $options->delete( OptionsInterface::MC_SETUP_COMPLETED_AT ); $options->delete( OptionsInterface::GOOGLE_CONNECTED ); } google-listings-and-ads/tests/e2e/utils/api.js
Lines 102 to 114 in 65972ac
/** * Set Onboarded Merchant. */ export async function setOnboardedMerchant() { await api().post( 'gla-test/onboarded-merchant' ); } /** * Clear Onboarded Merchant. */ export async function clearOnboardedMerchant() { await api().delete( 'gla-test/onboarded-merchant' ); }
After then, use them like this test file, and make sure to clear it in the test.afterAll
block.
tests/e2e/specs/product-feed/product-feed-campaign-notice.test.js
Outdated
Show resolved
Hide resolved
tests/e2e/specs/product-feed/product-feed-campaign-notice.test.js
Outdated
Show resolved
Hide resolved
tests/e2e/specs/product-feed/product-feed-campaign-notice.test.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the work and adjustments.
There are some suggestions for e2e tests and I believe it won't need a new round code review for these adjustments. I'll be approving it in advance.
tests/e2e/specs/product-feed/product-feed-campaign-notice.test.js
Outdated
Show resolved
Hide resolved
e7a0f64
into
feature/2460-google-ads-value-prop
Changes proposed in this Pull Request:
Closes #2539
Replace this with a good description of your changes & reasoning.
Screenshots:
When there is Product but no campaign: ( Show the notice )
When there is Product and a campaign: ( Don't show the notice )
Detailed test instructions:
Additional details:
Further more this ticket address a bug in
useAdsCampaign
#2539 (comment), which required certain E2E to be adjusted.Changelog entry