gnolang / gno

Gno: An interpreted, stack-based Go virtual machine to build succinct and composable apps + Gno.land: a blockchain for timeless code and fair open-source
https://gno.land/
Other
849 stars 345 forks source link

[docs] add analytics to the docs #1432

Closed zivkovicmilos closed 5 months ago

zivkovicmilos commented 6 months ago

Description

Currently, we do not have any analytics set up for our documentation. In the spirit of privacy, we already utilize Simple Analytics for most of our websites to get a sense for user needs. Having visibility into what users reference the most, or search for the most, will give us feedback on what we should focus on in the docs.

Similar to #1431, docs should be deployed to docs.gno.land before proceeding.

Since we utilize Docusaurus as the main documentation framework, we can tie it in with Simple Analytics. Example guide I've stumbled upon: https://docs.simpleanalytics.com/install-simple-analytics-with-docusaurus

Please ping @moul for setting up the Simple Analytics dashboard, once the Docusaurus plugin integration is complete.

moul commented 6 months ago

Simple analytics was already configured, we just need to add the snippet which is always the same for any website:

<!-- 100% privacy-first analytics -->
<script async defer src="https://sa.gno.services/latest.js"></script>
<noscript><img src="https://sa.gno.services/noscript.gif" alt="" referrerpolicy="no-referrer-when-downgrade" /></noscript>

https://github.com/gnolang/gno/blob/0664846a97a2ebb4f888dbfeb2a45566917b2e60/gno.land/cmd/gnoweb/views/funcs.html#L159C1-L161

leohhhn commented 6 months ago

@zivkovicmilos

I'm having trouble adding these simple analytics to our Docusaurus docs. It seems the plugin is flawed - for some reason it cannot be built.

I thought my old version of yarn was the problem, so I installed the newest (4.0.2) via corepack instead of brew/npm. This is not the case. When adding the plugin, the following error occurs:

> corepack yarn add docusaurus-plugin-simple-analytics@1.1.8    
➤ YN0000: · Yarn 4.0.2
➤ YN0000: ┌ Resolution step
➤ YN0085: │ + docusaurus-plugin-simple-analytics@npm:1.1.8, @docusaurus/core@npm:2.4.3, @docusaurus/cssnano-preset@npm:2.4.3, @docusaurus/logger@npm:2.4.3, @docusaurus/mdx-loader@npm:2.4.3, @docusaurus/types@npm:2.4.3, and 3 more.
➤ YN0000: └ Completed in 1s 304ms
➤ YN0000: ┌ Fetch step
➤ YN0013: │ 9 packages were added to the project (+ 1 MiB).
➤ YN0000: └ Completed in 0s 964ms
➤ YN0000: ┌ Link step
➤ YN0007: │ docusaurus-plugin-simple-analytics@npm:1.1.8 [ee24e] must be built because it never has been before or the last one failed
➤ YN0009: │ docusaurus-plugin-simple-analytics@npm:1.1.8 [ee24e] couldn't be built successfully (exit code 1, logs can be found here: /private/var/folders/j8/86dklsh11dq5n68m7mk99c_m0000gn/T/xfs-8537cf76/build.log)
➤ YN0000: └ Completed in 0s 970ms
➤ YN0000: · Failed with errors in 3s 278ms

Not really sure how to fix this - and the issues on their repo mention that this is a known issue, but no fix has been added.

Do we have an alternative analytics plugin in mind? If not, I will just include @moul's suggestion.

I'll see what devx is doing with play.gno.land regarding this and maybe we can utilize the same.

zivkovicmilos commented 6 months ago

@leohhhn

Yeah, I saw the issue on the repo as well 🙁

Let's go with the snippet @moul suggested, should be fine that way without the plugin