Code Monkey home page Code Monkey logo

sciter-analytics's Introduction

sciter in-app analytics

This is a sciter.js package for in-app analytics.

The general idea is to record what users do within the application in order to optimize the user experience within the app.

Two types of events are recorded:

  • events that are triggered by user actions (e.g. clicking a button)
  • events that are triggered by the application (e.g. a page is loaded)

The following application analytics providers have been implemented:

demo

  • git clone the repository
  • install packages npm install
  • install the latest sciter sdk npm run install-sdk
  • update the mixpanel project token or amplitude api key
  • 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
import Mixpanel from "node_modules/sciter-analytics/src/mixpanel.js";
import Amplitude from "node_modules/sciter-analytics/src/amplitude.js";

using source

  • copy the src dir to your project

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

import Mixpanel from "src/mixpanel.js";
import Amplitude from "src/amplitude.js";

Mixpanel sample

const mixpanel = new Mixpanel({
    // project token
    token: "c557e826f1a76aaa4ed02e4681f95ae4",
    // user unique id
    userId: Utils.uuid(),
    debug: true,
});

// add user properties
mixpanel.properties({
    // reserved properties
    $name: "John Doe",
    $email: "[email protected]",

    // custom properties
    address: "Some street",
    birthday: "1987-02-11",
});

// log event
mixpanel.event("App started");

// watch for event
mixpanel.watch("focus", "plaintext", "plaintext focused");

// send data
mixpanel.send();

Amplitude sample

const amplitude = new Amplitude({
    apikey: "0fad02b65a75f270c199db6b920fbf92",
    userId: Utils.randomStr(10),
    debug: true,
    eventProperties: {
        appName: "Sciter analytics",
        appRelease: "debug",
    },
});

amplitude.event("Start app");

// watch app close
amplitude.watch("closerequest", undefined, "App close request");

// watch app install click
amplitude.watch("click", "#installApp1", "Install app", {
    appName: "app 1",
});

amplitude.watch("click", "#installApp2", "Install app", {
    appName: "app 2",
});

amplitude.watch("click", "#installApp3", "Install app", {
    appName: "app 3",
});

other providers to consider

sciter-analytics's People

Contributors

8ctopus avatar windmarc avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.