Skip to content

marcioaffonso/insights-dashboard-sample

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Insights Dashboard Sample

Dashboard Sample which makes use of OpenTok Insights GraphQL API

Preview

Insights Dashboard Sample Preview

Local Installation

  1. Clone the repository.

  2. Install dependencies: npm install.

  3. Copy .env.template to .env and edit the environment variables.

  4. Run the server and the client app: npm start. This will run both the server (server.js) and the client app (react-scripts).

Configuration options

Configuration can be done using environment variables. You can create an .env file for easier config.

Environment Variable Names and Description:

  • REACT_APP_INSIGHTS_URL (Required): The URL for the OpenTok Insights API.
  • REACT_APP_API_KEY (Required): Your OpenTok API Key.
  • API_SECRET (Required): Your OpenTok API Secret.
  • SERVER_PORT (Required): The port number for your server to run on.
  • REACT_APP_SERVER_URL (Required): The URL for your server app.
  • APP_CLIENT_URL (Required): The URL for your client app.

Notice that all the environment variables used by the client start with REACT_APP_. This ensures that only those are accessible by the client, protecting your API secret.

Charts - Query samples

Usage by Day

Usage by Day

Query to Insights API (Sample)

{
  project(projectId: ${YOUR_API_KEY}) {
    projectData(
      start: ${moment().subtract(10, 'days')},
      interval: DAILY
    ) { 
      resources {
        intervalStart,
        intervalEnd,
        usage {
          streamedPublishedMinutes,
          streamedSubscribedMinutes
        }
      }
    }
  }
}

SDK Distribution

SDK Distribution

Query to Insights API (Sample)

{
  project(projectId: ${YOUR_API_KEY}) {
    projectData(
      start: ${moment().subtract(10, 'days')},
      groupBy: SDK_TYPE,
      sdkType: [JS, ANDROID, IOS]
    ) {
      resources {
        sdkType,
        usage {
          streamedSubscribedMinutes
        }
      }
    }
  }
}

Failures by Browser

Failures by Browser

Query to Insights API (Sample)

{
  project(projectId: ${YOUR_API_KEY}) {
    projectData(
      start: ${moment().subtract(10, 'days')},
      groupBy: BROWSER_NAME,
      browserName: [CHROME, FIREFOX, IE]
    ) { 
      resources {
        browserName,
        errors {
          guidConnect {
            failures
          },
          guidPublish {
            failures
          },
          guidSubscribe {
            failures
          }
        }
      }
    }
  }
}

Bitrate by Country

Bitrate by Country

Query to Insights API (Sample)

{
  project(projectId: ${YOUR_API_KEY}) {
    projectData(
      start: ${moment().subtract(10, 'days')},
      groupBy: COUNTRY,
      country: [AR, BR, ES, FR, MX, US]
    ) {
      resources {
        country,
        quality {
          subscriber {
            videoBitrateAvg
          }
        }
      }
    }
  }
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 60.6%
  • CSS 29.4%
  • HTML 10.0%