Menu

1 / 2

Building a Video Analytics Dashboard with Go and Chart.js

DEV Community·ahmet gedik·6 months ago
#v95DTsrl
#analytics#go#dashboard#javascript#json
Reading 0:00
15s threshold

Analytics for Asia-Pacific Video Trends

Understanding which regions drive traffic, which categories trend at which hours, and how K-pop compares to J-drama in engagement — these are the questions that shape content strategy for TopVideoHub . A lightweight Go backend serving pre-aggregated analytics to Chart.js covers all of it.

Go Analytics Server

package main

import ( "database/sql" "encoding/json" "log" "net/http"

_ "github.com/mattn/go-sqlite3" )

type Server struct { db * sql . DB }

func main () { db , err := sql . Open ( "sqlite3" , "./data/topvideohub.db?_journal_mode=WAL" ) if err != nil { log . Fatal ( err ) } defer db . Close ()

s := & Server { db : db } mux := http . NewServeMux () mux . HandleFunc ( "/api/analytics/views-by-region" , s . viewsByRegion ) mux . HandleFunc ( "/api/analytics/trending-categories" , s . trendingCategories ) mux . HandleFunc ( "/api/analytics/peak-hours" , s . peakHours )

log . Println ( "Analytics server on :8080" ) log . Fatal ( http .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.