Skip to content
ComputerElite edited this page Nov 20, 2021 · 13 revisions

Welcome to the ComputerAnalytics wiki!

Here you'll learn a bit about the Analytics process!

First, what even is this?

ComputerAnalytics is inspired by Google Analytics. It's basically an open source analytics software with which you can see the traffic on your website.

What data is being collected and stored?

Everything is stored in plain text atm

Every Analytic is stored in a seperate file in the servers directory. Analytics can only be recieved if the server is on. However if you get the analytics from somewhere else you can import them

We'll devide this into 2 sections:

Data provided via a POST request (what you send)

  • where you are on the website including everything in the address bar
  • When you opened the site and when you closed it
  • From which site you came

This data is being collected in this file

Date collected by the server (which come by default with every http request)

  • Your IP adress (to count the amount of persons accessing the website)
  • Your User Agent (aka browser)

This data is being collected in the Function Recieve in AnalyticsData which is at the time or writing here

How can I view my statistics?

After you started the server as an Administrator open http://localhost:502/. Then get the master token from the config file in the analytics folder and log in. Then add the website you want to collect statistics on. Copy its private token and then log in with that token. Now you can click links or the boxes to filter for that specific value (referrer, host, endpoint, query string, date).

How do I add it to my site?

To see my implementation on https://computerelite.github.io check here

If you host your Website with ComputerUtils Webserver

simply add this project as a reference and do following

HttpServer server = new HttpServer(); // If you already have a server setup you don't need to create a new one
AnalyticsServer analyticsServer = new AnalyticsServer();
server.StartServer(502); // The argument of the function is the port the server will be running on.
analyticsServer.AddToServer(server); // This will add every endpoint needed for analytics to your server

Then in your html files add the js file /analytics.js:

<script src="/analytics.js?origin=https://yoursite.com">

Hosting your site somewhere else?

You'll have to edit the analytics script and then add it to your site. Edit this file:

  1. Remove const analyticsHosts = [{0}] from the file.
  2. Change the last line with code to
navigator.sendBeacon("http://yourNiceSiteWhichIsHostingComputerAnalytics/analytics", blob)

where you replace the link with the right one.

If you cannot host a C# server I reccommend looking at the implementation of my site

Need help setting everything up?

Create a GitHub issue and describe your problem as well as you can

Clone this wiki locally