Giter Club home page Giter Club logo

your-analytics's People

Contributors

mikenikles avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

your-analytics's Issues

Use NULL instead of empty strings

os_name for example records an empty string when it can't be determined based on the user agent string.

Check all columns to make sure the DB columns are NULL instead of empty strings.

Convert all existing values from empty strings to NULL

Authorize user on the query-api

Make sure the authenticated user has access to the domain they request. The website prevents users from looking at domains they are not authorized for. However, the query-api needs to enforce that too.

Suppress dashboard authorization error log statements

When accessing the dashboard landing page, the following errors are displayed in the query-api service:

Error: User did:ethr:xyz tried to access domain dashboard but is not authorized.

Solution
Configure the website service not to send requests for the dashboard.

Set up architecture - FaunaDB

Structure:

  • A top-level your-analytics database used by the SaaS platform
    • [Collections
      • users: Used for authentication. Also contains an array of sites a user has access to.
    • Child databases (one per site)
      • E.g. example.com, your-analytics.org
        • Collections
          • users
          • settings

Deal with authorization

It's likely a good idea to ensure authenticated users see the analytics for their own domains only.

Blocked by #7.

Monitor services

Enable operational monitoring.

  • admin-api
  • db-analytics
  • events-api
  • query-api

Allow date ranges, presets and custom

Start with a select with the following options

  • Today
  • Last 7 days
  • Last 30 days
  • This year (Jan - Today)
  • Custom

Develop the API so it requires from/to date parameters. Deal with presets (e.g. last 7 days) on the client and create the from/to dates before calling the API

Improve events-api performance

Opening the GEO-IP database takes roughly 70 to 80ms. Improve the code to cache the open instance so it does not slow down each individual request.

Current request processing times:

image

Create a user ID hash

Instead of tracking users with a cookie, we use a more rudimentary approach based on a hash of the following data:

  • IP address
  • Browser User-Agent

The IP address is not persisted, it is only used to generate the hash and helps to differentiate multiple users behind a NAT gateway.

Develop an onboarding experience

When a user logs in who does not yet have a site registered, walk them through a wizard-like onboarding experience. Keep this as lightweight as possible.

  • Ask for domain name
  • Provide JS snippet with installation instructions

Related to #7.

Allow for analytics to be public

Given Your Analytics' openness, we want to allow anyone to publish their dashboard publicly.

The first use case is for our own marketing landing page where we want to display live stats for your-analytics.org to demonstrate the features.

Fetch analytics for the requested website

For requests to the query-api's /example.com/* endpoints, validate the user is authorized to access stats for the given website.

Do this with a call to the Fauna DB to validate.

Log an error when the user agent can't be parsed

This helps identify situations where for example os_name can't be determined.

#46 ensures NULL is recorded for the os_name in the DB. By logging an error, an alert pops up and UA strings can be manually reviewed to determine how to improve the logic to make sure more UA strings can be parsed properly.

Migrate from SSG to SSR

Due to #31 where we now have dynamic pages at www.your-analytics.org/example.com, SSG no longer works, unless we auto-generate URLs for all configured sites. At this point, this on-the-fly SSG is not really feasible with a reasonable effort.

Moreover, adopting a SSR approach will open the doors to hosting the APIs and website on the same domain, hence eliminating the need for CORS. If not on Vercel (to be investigated), then definitely on Firebase where static assets are hosted on Firebase Hosting and dynamic requests routed to Cloud Run instances, i.e. for the APIs and SSR.

Fix TypeError

TypeError: Cannot read property 'en' of undefined
2020-07-25 12:11:56.143 BST at /app/src/index.js:51:53

Set up architecture - Website

Until Vercel supports monorepos (https://twitter.com/mikenikles/status/1281704513351618563), we can only host one service per GitHub repository on Vercel.

Because of that, we need to make sure the generated ya.js file in packages/events-script gets copied to services/website/static/ya.js. This ensures the file is available at https://your-analytics.org/ya.js.

Once Vercel monorepo support is available, we can likely move the ya.js to https://script.your-analytics.org/ya.js and create a permanent redirect from https://your-analytics.org/ya.js to https://script.your-analytics.org/ya.js. Traffic to the old URL can be monitored and once no more traffic hits that file, the redirect can be removed.

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.