Skip to content

Conversation

@runemadsen
Copy link
Member

This PR fixes #460 by tracking download events in Fathom Analytics. I implemented this with the useGoal that is a part of the gatsby-plugin-fathom package. It's a little annoying that we need to run a hook per goal, but the library handles a lot of stuff around dev/prod and SSR so I'd rather rely on that.

Adding @fdoflorenzano so they can take a look.

CC @SableRaf

@runemadsen runemadsen requested a review from fdoflorenzano May 30, 2023 07:40
@SableRaf
Copy link
Collaborator

SableRaf commented May 30, 2023

Hi @runemadsen and thanks for this!

I tried all events and everything seems to be working ✨

Note: one event doesn't appear on the screenshot below because of pagination.

image

Once @fdoflorenzano gives this PR the thumbs up on the code side, I'll happily merge and release.

@SableRaf
Copy link
Collaborator

I had a closer look at the code, and it looks good to me! @fdoflorenzano do let me know if you notice anything that needs changing. In the meantime I'll go ahead with the merge. Thanks again for your help on this @runemadsen.

@SableRaf SableRaf merged commit 1b12731 into main May 31, 2023
Copy link
Contributor

@fdoflorenzano fdoflorenzano left a comment

Choose a reason for hiding this comment

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

Looks great and works locally for me too! Just left a little question as a comment.

Comment on lines +46 to +56
trackWindows(0);
} else if (asset.os === 'macOS' && asset.bit === 'Intel 64-bit') {
trackMacIntel(0);
} else if (asset.os === 'macOS' && asset.bit === 'Apple Silicon') {
trackMacSilicon(0);
} else if (asset.os === 'Linux') {
trackLinux(0);
} else if (asset.os === 'Raspberry Pi' && asset.bit === '32-bit') {
trackPi32(0);
} else if (asset.os === 'Raspberry Pi' && asset.bit === '64-bit') {
trackPi64(0);
Copy link
Contributor

Choose a reason for hiding this comment

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

From what I understood from the docs, the callback don't need to have an argument defined (the default is 0 actually). Tested removing it locally and it works fine. Is there a reason behind actually setting the value that I'm not seeing @runemadsen? If so, we could add it as a comment then.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, good catch. I just saw them passing 0 in the documentation and assumed it worked like the official API. We can change that.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks @fdoflorenzano! Feel free to make another PR for this tweak.

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.

Add Fathom Analytics Event Tracking to Downloads

4 participants