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

Add GA event tracking for the Audiences Tiles (excluding the "Top content" metric area) #9567

Merged
merged 31 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
eeefec4
Refactor AudienceTilesWidget to be a JS module.
techanvil Oct 25, 2024
cd94441
Add `insufficient_permissions_error`, `insufficient_permissions_error…
techanvil Oct 25, 2024
4f1743b
Add `view_tile_tooltip` and `view_partial_data_tile_tooltip` GA event…
techanvil Oct 25, 2024
8184638
Add `view_top_content_partial_data_tooltip` GA event to AudienceTileP…
techanvil Oct 25, 2024
ebd087d
Add `view_tile_collecting_data` and `temporarily_hide` GA events to A…
techanvil Oct 25, 2024
4cc530b
Add `insufficient_permissions_error`, `insufficient_permissions_error…
techanvil Oct 25, 2024
66dd911
Fix tests.
techanvil Oct 25, 2024
196b674
Add `view_tile_tooltip` GA event to AudienceTiles.
techanvil Oct 25, 2024
307b94f
Wrap `TileErrorContent` in `forwardRef()`.
techanvil Oct 25, 2024
f3f460f
Fix `insufficient_permissions_error_request_access` GA event in Audie…
techanvil Oct 25, 2024
4ba47f8
Prevent Tooltip's `onOpen` prop from being called while the tooltip i…
techanvil Oct 25, 2024
87428d6
Fix GA event name, rename `view_partial_data_tile_tooltip` to `view_t…
techanvil Oct 25, 2024
c0731ce
Add AudienceTileError tests for the `insufficient_permissions_error`,…
techanvil Oct 28, 2024
abd2823
Fix missing report for AudienceTilesWidget tests.
techanvil Oct 28, 2024
019ee91
Fix call to `view_tile_tooltip` in AudienceTiles.
techanvil Oct 28, 2024
e8c2dd0
Fix `view_tile_collecting_data` GA event name.
techanvil Oct 28, 2024
a3ce229
Add tests for `view_tile_collecting_data` and `temporarily_hide` GA e…
techanvil Oct 28, 2024
719df73
Update tests for consistency.
techanvil Oct 28, 2024
da4d633
Reorganise tests.
techanvil Oct 28, 2024
933e8b9
Update tests for consistency.
techanvil Oct 28, 2024
9ad495c
Add tests for `insufficient_permissions_error`, `insufficient_permiss…
techanvil Oct 28, 2024
0688a99
Restore snapshot order.
techanvil Oct 28, 2024
a743d48
Add test for `view_tile_tooltip` GA event in AudienceTilesWidget.
techanvil Oct 28, 2024
098b8c1
Add test for `view_tile_tooltip` GA event in AudienceTile (zero data …
techanvil Oct 28, 2024
b229420
Add test for `view_tile_tooltip` GA event in AudienceTile.
techanvil Oct 28, 2024
d207a00
Add test for `view_tile_partial_data_tooltip` GA event in AudienceTile.
techanvil Oct 28, 2024
55cbf01
Add tests for the `view_top_content_partial_data_tooltip` and `view_t…
techanvil Oct 28, 2024
f215a8c
Remove commented out lines.
techanvil Oct 28, 2024
3e24cb6
Improve test stability.
techanvil Oct 28, 2024
42f6270
Improve test stability.
techanvil Oct 28, 2024
3013ac3
Address minor CR feedback.
nfmohit Nov 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion assets/js/components/BadgeWithTooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import InfoTooltip from './InfoTooltip';
export default function BadgeWithTooltip( {
className = '',
label,
onTooltipOpen,
tooltipTitle,
} ) {
return (
Expand All @@ -41,12 +42,15 @@ export default function BadgeWithTooltip( {
) }
>
{ label }
{ tooltipTitle && <InfoTooltip title={ tooltipTitle } /> }
{ tooltipTitle && (
<InfoTooltip onOpen={ onTooltipOpen } title={ tooltipTitle } />
) }
</span>
);
}

BadgeWithTooltip.propTypes = {
onTooltipOpen: PropTypes.func,
tooltipTitle: PropTypes.node,
className: PropTypes.string,
label: PropTypes.node.isRequired,
Expand Down
4 changes: 3 additions & 1 deletion assets/js/components/InfoTooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import PropTypes from 'prop-types';
import { Tooltip } from 'googlesitekit-components';
import InfoIcon from '../../svg/icons/info-green.svg';

export default function InfoTooltip( { title, tooltipClassName } ) {
export default function InfoTooltip( { onOpen, title, tooltipClassName } ) {
if ( ! title ) {
return null;
}
Expand All @@ -45,6 +45,7 @@ export default function InfoTooltip( { title, tooltipClassName } ) {
enterTouchDelay={ 0 }
leaveTouchDelay={ 5000 }
interactive
onOpen={ onOpen }
>
<span>
<InfoIcon width="16" height="16" />
Expand All @@ -54,6 +55,7 @@ export default function InfoTooltip( { title, tooltipClassName } ) {
}

InfoTooltip.propTypes = {
onOpen: PropTypes.func,
title: PropTypes.oneOfType( [ PropTypes.string, PropTypes.element ] ),
tooltipClassName: PropTypes.string,
};
3 changes: 3 additions & 0 deletions assets/js/components/ReportErrorActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export default function ReportErrorActions( props ) {
hideGetHelpLink,
buttonVariant,
onRetry,
onRequestAccess,
getHelpClassName,
RequestAccessButton,
RetryButton,
Expand Down Expand Up @@ -132,6 +133,7 @@ export default function ReportErrorActions( props ) {
/>
) : (
<Button
onClick={ onRequestAccess }
href={ requestAccessURL }
target="_blank"
danger={ buttonVariant === 'danger' }
Expand Down Expand Up @@ -208,6 +210,7 @@ ReportErrorActions.propTypes = {
hideGetHelpLink: PropTypes.bool,
buttonVariant: PropTypes.string,
onRetry: PropTypes.func,
onRequestAccess: PropTypes.func,
getHelpClassName: PropTypes.string,
RequestAccessButton: PropTypes.elementType,
RetryButton: PropTypes.elementType,
Expand Down
32 changes: 32 additions & 0 deletions assets/js/googlesitekit/components-gm2/Tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,40 @@ import PropTypes from 'prop-types';
import classnames from 'classnames';
import { Tooltip as MuiTooltip } from '@material-ui/core';

/**
* WordPress dependencies
*/
import { useRef } from '@wordpress/element';

export default function Tooltip( {
children,
popperClassName,
tooltipClassName,
onOpen,
onClose,
nfmohit marked this conversation as resolved.
Show resolved Hide resolved
...props
} ) {
const isOpen = useRef( false );

const handleOpen = onOpen
? () => {
// This fixes a bug where the `onOpen` callback is called when the tooltip is already open.
if ( isOpen.current ) {
return;
}

isOpen.current = true;
onOpen?.();
}
: undefined;

const handleClose = onOpen
? () => {
isOpen.current = false;
onClose?.();
}
: onClose;

return (
<MuiTooltip
classes={ {
Expand All @@ -42,6 +70,8 @@ export default function Tooltip( {
),
} }
arrow
onOpen={ handleOpen }
onClose={ handleClose }
{ ...props }
>
{ children }
Expand All @@ -53,4 +83,6 @@ Tooltip.propTypes = {
children: PropTypes.node,
popperClassName: PropTypes.string,
tooltipClassName: PropTypes.string,
onOpen: PropTypes.func,
onClose: PropTypes.func,
};

This file was deleted.

Loading
Loading