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

Support for fathom JS #86

Closed
amirhouieh opened this issue Jun 26, 2023 · 9 comments
Closed

Support for fathom JS #86

amirhouieh opened this issue Jun 26, 2023 · 9 comments
Assignees

Comments

@amirhouieh
Copy link
Contributor

Some BUs require to inject fathom JS snipped to their client. It seems that we might nether to add some code or develop a plugin for it. Here is a relavant discussion.

atm, only Waku has asked but we need to make it scalable so parameters can be customized. Here is the sample script received from @serhanwbahar.

<!-- Fathom - simple website analytics - https://github.com/usefathom/fathom -->
<script>
(function(f, a, t, h, o, m){
    a[h]=a[h]||function(){
        (a[h].q=a[h].q||[]).push(arguments)
    };
    o=f.createElement('script'),
    m=f.getElementsByTagName('script')[0];
    o.async=1; o.src=t; o.id='fathom-script';
    m.parentNode.insertBefore(o,m)
})(document, window, '//fathom.status.im/tracker.js', 'fathom');
fathom('set', 'siteId', 'FUTMI');
fathom('trackPageview');
</script>
<!-- / Fathom -->
@jeangovil
Copy link
Contributor

jeangovil commented Jun 26, 2023

  • Create a Docusaurus client module using the script provided by Serhan.
  • Listen to route change events using client module lifecycles, and invoke trackPageview upon each route change.
  • Create a Docusaurus plugin (@acid-info/docusaurus-fathom) that injects the script into client modules.
  • Add plugin options for custom siteId and scriptUrl values.
  • Use the plugin on the docs.waku.org website.

@jeangovil jeangovil assigned jinhojang6 and unassigned jeangovil Jun 26, 2023
@fryorcraken
Copy link

For docs.waku.org, can we just include the snippet somewhere in the docs.waku.org repo for now, and remove it once plugin is in place? Cc @LordGhostX

@jinhojang6
Copy link
Contributor

jinhojang6 commented Jun 27, 2023

I will submit a PR today but I think we can do it, if it is urgent. What do you think @jeangovil ?

@amirhouieh
Copy link
Contributor Author

@jinhojang6 but this should not take much of time! how long is your estimate to get this fixed?

@jinhojang6
Copy link
Contributor

jinhojang6 commented Jun 27, 2023

@amirhouieh I am new to the docusaurus client module and integrating a plugin so needed some initial time to understand the overall architecture. Will submit a pull request today.

@jinhojang6
Copy link
Contributor

Pull Request at #87

@jeangovil
Copy link
Contributor

@serhanwbahar, the server returns an empty response for https://fathom.status.im/tracker.js

@jinhojang6
Copy link
Contributor

Pull request to implement fathom for docs.waku.org : waku-org/docs.waku.org#76

@jinhojang6
Copy link
Contributor

Solved all the issues with the infra team

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

No branches or pull requests

4 participants