# Website Analytics

## Overview

Use [Leto](https://leto.gg/) with an IPFS hosted website to monitor traffic, watch for system abuse, and improve your system.&#x20;

In this example, an HTML webpage is uploaded to IPFS via [Web3.storage](https://web3.storage/) and is retrieved using the [Leto IPFS gateway](https://letodev.gitbook.io/getting-started/documentation/ipfs-gateway-api). Anonymous analytics data is then accessible through the [Leto dashboard](https://leto.gg/) or [Analytics API](https://letodev.gitbook.io/getting-started/documentation/analytics-rest-api).

## Link in Bio webpage on IPFS

We made a Link in Bio webpage for this example. Feel free to make any type of webpage that suits your needs!

Create a simple html webpage to display your important links. View the code used in this example [here](https://github.com/Leto-gg/examples/tree/main/linkInBio). For this example, there is some basic css in the index.html file to make it easy to upload to IPFS via [Web3.storage](https://web3.storage/).

<figure><img src="https://4005174896-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8uUFIFZLPiuuBm5QlAX8%2Fuploads%2FZJm1nv5UttVNzspmRVCW%2F1-%20linkInBio.png?alt=media&#x26;token=dee14973-243c-48c9-99b6-e8a4f9fadccc" alt="" width="563"><figcaption></figcaption></figure>

{% hint style="info" %}
If you want to include other files (like a separate css file) or have an app like a react app, you will have to build it and then upload the build folder to [Web3.storage](https://web3.storage/). You can use providers like [Spheron](https://spheron.network/) and [Dappling](https://dappling.network/) to build the file and launch the app on IPFS for you.
{% endhint %}

### Web3.storage <a href="#web3.storage" id="web3.storage"></a>

Login to [web3.storage](https://web3.storage/), make a space, and upload your index.html file.

​​

<figure><img src="https://4005174896-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8uUFIFZLPiuuBm5QlAX8%2Fuploads%2FLSdf7xUDRRRMefu1WZ7O%2FScreenshot%202023-11-30%20at%209.33.32%E2%80%AFPM.png?alt=media&#x26;token=4779b4d1-5398-4477-a4ec-b57e5db9ede1" alt="" width="375"><figcaption></figcaption></figure>

Now, the index.html file (in this case a webpage) is accessible by clicking the link under “CID”. <https://bafkreiedazv25tc7idkywbco3jxrywdnb3g4ff3pqegrmshhtcpk5zgsyi.ipfs.w3s.link>

<figure><img src="https://4005174896-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8uUFIFZLPiuuBm5QlAX8%2Fuploads%2FHYom1MxIIsRkTuH1U9T8%2FScreenshot%202023-11-30%20at%209.35.06%E2%80%AFPM.png?alt=media&#x26;token=df6a74f9-2465-456e-ad9d-07aae02b2c2d" alt="" width="563"><figcaption></figcaption></figure>

To collect anonymous analytics for this webpage, input your CID into the following link format `https://leto.gg/ipfs/{yourCID}` instead of using the link provided by web3.storage: <https://leto.gg/ipfs/bafkreiedazv25tc7idkywbco3jxrywdnb3g4ff3pqegrmshhtcpk5zgsyi>

When users retrieve the webpage through this link, anonymous analytics data is generated. It’s that easy to host a webpage on IPFS and measure webpage performance with Leto!

## Interacting with your analytics

Use the Leto dashboard to view the analytics data generated by your webpage. Login at [Leto.gg](https://leto.gg/) and select “CIDs''. Input the CID for your website. <br>

<figure><img src="https://4005174896-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8uUFIFZLPiuuBm5QlAX8%2Fuploads%2F34LkKG1YhY5f48PSDecJ%2FScreenshot%202023-11-30%20at%209.59.44%E2%80%AFPM.png?alt=media&#x26;token=e1354278-e75e-4b1b-9730-a219d372c059" alt="" width="563"><figcaption></figcaption></figure>
