-
Notifications
You must be signed in to change notification settings - Fork 286
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
Issue / 8458 Add GA Events for Ads Notification #8474
Issue / 8458 Add GA Events for Ads Notification #8474
Conversation
…tion and track events for view and dismiss actions.
Build files for 21ea00b have been deleted. |
Size Change: +640 B (0%) Total Size: 1.42 MB
ℹ️ View Unchanged
|
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 @10upsimon LGTM
I updated muteFetch
so id doesn't go back and forth for a very small change that I suggested. I also expanded a bit on QAB to include way for setting the Ads Conversion ID field, since there is no more visible field, it will need a small snippet to update the setting.
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.
Excellent work here, thank you @10upsimon. I've left a couple comments, which once addressed, we should be able to get this in.
assets/js/modules/analytics-4/components/settings/AdsConversionIDSettingsNotice.js
Outdated
Show resolved
Hide resolved
…b.com:google/site-kit-wp into issue/8458-add-ga-events-for-ads-notification.
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.
Hi @10upsimon. Thank you for addressing the feedback. I apologise, I have found one additional concern regarding the view_notification
trackEvent
call, and I have left two other minor comments. Please let me know what you think, thanks!
assets/js/modules/analytics-4/components/settings/AdsConversionIDSettingsNotice.js
Outdated
Show resolved
Hide resolved
assets/js/modules/analytics-4/components/settings/AdsConversionIDSettingsNotice.js
Outdated
Show resolved
Hide resolved
…b.com:google/site-kit-wp into issue/8458-add-ga-events-for-ads-notification.
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.
Thank you so much for the excellent work, @10upsimon. Thank you for the assist, @techanvil!
I have left what I believe is my last set of very minor feedback, mostly cosmetic and adherence to best practices. Let me know what you think, thanks!
assets/js/components/SettingsNotice/SettingsNoticeWithIntersectionObserver.js
Outdated
Show resolved
Hide resolved
assets/js/components/SettingsNotice/SettingsNoticeWithIntersectionObserver.js
Outdated
Show resolved
Hide resolved
// TODO: This could renamed/moved to be more generic e.g. `ComponentWithIntersectionObserver`, | ||
// or refactored to a HOC. | ||
function SettingsNoticeWithIntersectionObserver( { |
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.
As @techanvil mentioned here, let's actually address this comment now and turn this into a more generic component, as this functionality doesn't need to be specific to the SettingsNotice
component, I think. ComponentWithIntersectionObserver
sounds great!
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.
@nfmohit @techanvil I have addressed this as a new ComponentWithIntersectionObserver
component as per recent commits. I simply merely implemented it as a component with children, and in testing this seemed to work fine. Any concerns with this? See the commit at 32a7df0
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.
LGTM! I'll keep this open for @techanvil.
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.
Hey @10upsimon, thanks for addressing that. However, I notice that the approach you've taken introduces a new div
element to wrap the children.
Seeing as the longer term intention here is to address the problem with useIntersection()
, at which point we can remove this workaround, I'd rather we don't introduce additional markup via ComponentWithIntersectionObserver
which will then be removed when the component is stripped out.
This can be addressed in quite a straightforward manner by rewriting the component as a HOC and passing the ref directly to the wrapped component.
I've had a quick go at this myself, creating withIntersectionObserver()
and removing ComponentWithIntersectionObserver
.
Although we usually cover our HOC functions with tests, I think we can skip it on this occasion, as long as we're clear about the fact it's just an interim measure.
On that note, it looks like this point in my previous comment has been missed:
- Simon, if you haven't already, please can you file a followup issue to provide an improved version of
useIntersection()
and replace our current use of the version fromreact-use
?
So, please can you do the following?
- Take a look at the HOC implementation that I've provided and see what you think, if you are happy with it I'll get this merged.
- File that GH issue to make sure we do follow up and address the issue with
useIntersection()
.
Cheers!
Cc @nfmohit
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 @techanvil I took a look at your change, and while I need to understand it a little better, I get the gist of it and I tested it and the event still fires correctly, so I'm happy with those changes.
I have indeed added it to my TODO list to create that issue, I did not realise the creation of said issue was a blocker for this PR to be approved, apologies for that, I'll get onto that soon. If we can move this ahead so long, that will help a lot.
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 @10upsimon! As discussed on Slack, creating the followup isn't a blocker for this, I just wanted to make sure it's on your radar.
I'll get this one merged, cheers!
assets/js/components/SettingsNotice/SettingsNoticeWithIntersectionObserver.js
Outdated
Show resolved
Hide resolved
assets/js/modules/analytics-4/components/settings/AdsConversionIDSettingsNotice.js
Outdated
Show resolved
Hide resolved
…mponentWithIntersectionObserver component for easier reuse.
…rsion ID settings notice.
…tionObserver component.
…ew div wrapper from ComponentWithIntersectionObserver component.
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.
Thank you @10upsimon. This looks excellent. I have pointed out some minor improvements, so minor that I've applied them myself. I hope that is okay with you, thanks!
assets/js/modules/analytics-4/components/settings/AdsConversionIDSettingsNotice.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.
LGTM, thank you @10upsimon!
I'll let @techanvil do the honours here and do a final MR and respond to this question. Thanks!
assets/js/modules/analytics-4/components/settings/AdsConversionIDSettingsNotice.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 @10upsimon, this is looking good but please can you review my comment here? #8474 (comment)
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.
LGTM, nice one @10upsimon!
Summary
Addresses issue:
Relevant technical choices
SettingsNotice
to acceptdismissCallback
prop that calls said callback function when the notices is dismissed via said UI elementAdsConversionIDSettingsNotice
dismissCallback
prop added toSettingsNotice
SettingsNotice
component asSettingsNotice.test.js
dismissCallback
function fires as expected during notice dismissaltrackEvent
functionality as that is isolated fromSettingsNotice
and handled within a separate component that merely callsSettingsNotice
, in this caseAdsConversionIDSettingsNotice
PR Author Checklist
Do not alter or remove anything below. The following sections will be managed by moderators only.
Code Reviewer Checklist
Merge Reviewer Checklist