Share important analytics you collect using Leto Analytics with your community! Easily showcase activity data for NFTs, webpages, and more with a static, public stats page (in descending order by view count).
Feel free to use this repo to make your own community stats page!
Follow the steps below to set up and run the commuityStats React App in development mode:
-
Clone the Repository:
git clone [https://github.com/galaxyxtwo/communityStats] cd [communityStats] -
Add your CIDs:
This app has an example list of IPFS CIDs in src/app.js. Before launching your app, change these CIDs to the production CIDs that you want to display in the leaderboard.
Note: Only IPFS CIDs that have been accessed through the Leto IPFS Gateway will return a view count, called "numberAccessed.
- Run the Development Server:
npm install npm start
After executing the above command, the react app should be running in development mode. Navigate to the specified local server address in your browser to view the website.
To run this application in the cloud, choose a hosting provider and then use a cloudflare worker for the api request. Check out the /worker code in this other example. /worker is Javascript code meant for a Cloudflare worker that processes api requests. /src is the front-end built with React.
communityStats uses the Leto Analytics API to display a view count for each CID. To make it easy, steps are included to host the communityStats page on IPFS hosting provider, Spheron. This is an awesome IPFS hosting provider, but technically communityStats can be hosted on any cloud provider.
This repo is similar to the viewIpfsAnalytics example, but doesnt include an input box to add CIDs. This allows a developer or community to manage what data is added onto the community webpage.
Learn more about Leto by visiting the Leto docs!