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

Metris: improve marketplace activity metrics to prepare next version #10495

Merged
merged 1 commit into from
Jun 21, 2021

Conversation

markkaylor
Copy link
Contributor

What does it do?

adds send events when user visits marketplace or downloads a plugin

@markkaylor markkaylor self-assigned this Jun 16, 2021
@codecov
Copy link

codecov bot commented Jun 16, 2021

Codecov Report

Merging #10495 (e94e7ee) into master (c7c549a) will not change coverage.
The diff coverage is n/a.

❗ Current head e94e7ee differs from pull request most recent head bf233da. Consider uploading reports for the commit bf233da to get more accurate results
Impacted file tree graph

@@           Coverage Diff           @@
##           master   #10495   +/-   ##
=======================================
  Coverage   58.01%   58.01%           
=======================================
  Files         185      185           
  Lines        6431     6431           
  Branches     1400     1400           
=======================================
  Hits         3731     3731           
  Misses       2236     2236           
  Partials      464      464           
Flag Coverage Δ
front ∅ <ø> (∅)
unit 58.01% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c7c549a...bf233da. Read the comment docs.

remidej
remidej previously approved these changes Jun 16, 2021
Copy link
Contributor

@remidej remidej left a comment

Choose a reason for hiding this comment

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

Looks good to me as long as we update the strapi/tracker repo too for these events

const { error, isLoading, data } = useFetchPluginsFromMarketPlace();

if (isLoading || error) {
return <LoadingIndicatorPage />;
}

const handleDownloadPlugin = async pluginId => {
emitEvent('willInstallPlugin', { pluginId });
Copy link
Member

Choose a reason for hiding this comment

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

For other events with use the property plugin for the name of the plugin we should probably make this consistent

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, did you mean { plugin: pluginId }. I made that update but if I misunderstood just let me know 🙃

@@ -53,6 +56,12 @@ const LeftMenuLinkContent = ({
<LinkLabel>{labelId}</LinkLabel>
);

const handleClick = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you set it in a useEffect hook directly in the <MarketPlacePage /> ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok yes I considered it but wasn't sure which approach was better. Thanks.

@@ -38,6 +41,7 @@ const MarketPlacePage = () => {
const response = await request('/admin/plugins/install', opts, overlayblockerParams);

if (response.ok) {
emitEvent('didInstallPlugin', { plugin: pluginId });
Copy link
Contributor

Choose a reason for hiding this comment

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

Installing a plugin takes quite some time I am not sure that this event will ever pop up but let's keep it.

Comment on lines 16 to 20
const memoizedEmit = useCallback(() => {
emitEvent('didGoToMarketplace');
}, [emitEvent]);

useEffect(() => {
memoizedEmit();
}, [memoizedEmit]);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@soupette Is this the correct way to do this? Originally I thought if I just added an empty dependency array to the useEffect it would only fire on first render, but eslint wanted the emitEvent function in the dependency array.

Copy link
Contributor

Choose a reason for hiding this comment

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

the best way to remove the emit from the dependency array is to use a ref:

const emitEventRef = useRef(emitEvent);

useEffect(() => {
  emitEventRef.current('didGotToMarketplace');
}, [])

Copy link
Contributor

@soupette soupette left a comment

Choose a reason for hiding this comment

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

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: enhancement Issue suggesting an enhancement to an existing feature source: core:admin Source is core/admin package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants