WindMarc / sciter-analytics

Sciter analytics experiment

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sciter in-app analytics

This is a sciter.js in-app analytics experiment. The general idea is to record what users do within the application.

The app records:

  • environment variables: app name, version, operating system, ...
  • events: whatever event you want to track

===== IT IS WORK IN PROGRESS =====

demo

  • git clone the repository
  • install packages npm install
  • install latest sciter sdk npm run install-sdk
  • start the demo npm run scapp

demo requirements

  • A recent version of Node.js node (tested with 16 LTS) and its package manager npm.

add to your project

using npm

  • install package npm install sciter-analytics

using source

  • copy the src dir to your project

Add to your project inside <script type="module">

// import using npm
import Analytics from "node_modules/sciter-analytics/src/analytics.js";

// import from src
import Analytics from "src/analytics.js";

// initialize
Analytics.init({
    log: true,
    endpoint: "http://localhost/index.php",
    //endpoint: "https://httpbin.org/post",
});

// add more environmental variables
Analytics.env({
    name: "my app name",
    version: "0.0.1",
    uuid: uuid(),
});

// log event
Analytics.event("app started");

// watch
Analytics.watch("focus", "plaintext", "plaintext focused");

// log what happened
Analytics.log();

// send data
Analytics.send();

endpoints to test

todo

  • fix uuid
  • add first endpoint
  • test fetch error management - https - server refused answer - server error

About

Sciter analytics experiment

License:MIT License


Languages

Language:HTML 59.5%Language:JavaScript 31.0%Language:CSS 5.5%Language:PHP 4.1%