This commit is contained in:
@@ -10,12 +10,8 @@ export function Analytics() {
|
||||
// Send beacon on mount and path change
|
||||
const sendBeacon = async () => {
|
||||
try {
|
||||
// Point to the Admin Dashboard API
|
||||
// In prod, this URL needs to be the absolute URL of admin_dash
|
||||
// For local docker, standard localhost access might work if CORS allows,
|
||||
// or we route through a proxy.
|
||||
// For this personal setup, let's assume they are on same domain or localhost.
|
||||
await fetch('http://localhost:3000/api/track', { // TODO: Make this configurable
|
||||
// Send beacon to THIS website's API, which will relay it to the admin dash
|
||||
await fetch('/api/analytics', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ path: pathname, timestamp: Date.now() }),
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
|
||||
Reference in New Issue
Block a user