Skip to content

🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.

Remove SessionsTable component and refactor server API routes for analytics

Bill Yang0c69c3f77ac4
diff --git a/client/src/app/[site]/sessions/components/SessionsTable.tsx b/client/src/app/[site]/sessions/components/SessionsTable.tsx
deleted file mode 100644
index 07af00c37..000000000
--- a/client/src/app/[site]/sessions/components/SessionsTable.tsx
+++ /dev/null
@@ -1,234 +0,0 @@
-import { Skeleton } from "@/components/ui/skeleton";
-import {
- createColumnHelper,
- flexRender,
- getCoreRowModel,
- useReactTable,
-} from "@tanstack/react-table";
-import Avatar from "boring-avatars";
-import { DateTime } from "luxon";
-import { useParams, useRouter } from "next/navigation";
-import { useEffect, useMemo, useRef } from "react";
-import { getCountryName } from "../../../../lib/utils";
-import { Browser } from "../../components/shared/icons/Browser";
-import { CountryFlag } from "../../components/shared/icons/CountryFlag";
-import { OperatingSystem } from "../../components/shared/icons/OperatingSystem";
-import { GetSessionsResponse } from "../../../../api/analytics/userSessions";
-
-interface SessionsTableProps {
- data: GetSessionsResponse;
- isLoading: boolean;
- fetchNextPage: () => void;
- hasNextPage: boolean | undefined;
- isFetchingNextPage: boolean;
-}
-
-// Skeleton row component for loading state
-const SkeletonRow = ({ columns }: { columns: number }) => {
- return (
- <tr className="bg-neutral-900">
- {Array.from({ length: columns }).map((_, index) => (
- <td key={index} className="px-4 py-3 whitespace-nowrap">
- <Skeleton className="h-6 w-full max-w-[120px]" />
- </td>
- ))}
- </tr>
- );
-};
-
-export default function SessionsTable({
- data,
- isLoading,
- fetchNextPage,
- hasNextPage,
- isFetchingNextPage,
-}: SessionsTableProps) {
- const { site } = useParams();
- const router = useRouter();
-
- // Reference for the scroll container
- const tableContainerRef = useRef<HTMLDivElement>(null);
-
- // Infinite scroll implementation
- useEffect(() => {
- const handleScroll = () => {
- if (!tableContainerRef.current) return;
-
- const { scrollHeight, scrollTop, clientHeight } =
- tableContainerRef.current;
-
- // Load more when user scrolls to bottom (with a 200px buffer)
- if (
- scrollHeight - scrollTop - clientHeight < 200 &&
- !isFetchingNextPage &&
- hasNextPage
- ) {
- fetchNextPage();
- }
- };
-
- const tableContainer = tableContainerRef.current;
- if (tableContainer) {
- tableContainer.addEventListener("scroll", handleScroll);
- return () => {
- tableContainer.removeEventListener("scroll", handleScroll);
- };
- }
- }, [fetchNextPage, hasNextPage, isFetchingNextPage]);
-
- // Column definition
- const columnHelper = createColumnHelper<GetSessionsResponse[number]>();
-
- const columns = useMemo(
- () => [
- columnHelper.accessor("user_id", {
- header: "User",
- cell: (info) => {
- const userId = info.getValue();
- return (
- <Avatar
- name={userId}
- colors={["#2c2b4b", "#a75293", "#9c7a9d", "#9ddacb", "#f8dcb4"]}
- variant="beam"
- size={30}
- />
- );
- },
- }),
- columnHelper.accessor("session_end", {
- header: "Last Seen",
- cell: (info) => {
- return DateTime.fromSQL(info.getValue()).toFormat(
- "MMM d, yyyy h:mm a"
- );
- },
- }),
- columnHelper.accessor("pageviews", {
- header: "Pageviews",
- cell: (info) => info.getValue(),
- }),
- columnHelper.accessor("country", {
- header: "Country",
- cell: (info) =>
- info.getValue() ? (
- <div className="flex items-center gap-2">
- <CountryFlag country={info.getValue() || "Unknown"} />
- {getCountryName(info.getValue() || "Unknown")}
- </div>
- ) : (
- "-"
- ),
- }),
- columnHelper.accessor("browser", {
- header: "Browser",
- cell: (info) => (
- <div className="flex items-center gap-2">
- <Browser browser={info.getValue() || "Unknown"} />
- {info.getValue() || "Unknown"}
- </div>
- ),
- }),
- columnHelper.accessor("operating_system", {
- header: "OS",
- cell: (info) =>
- info.getValue() ? (
- <div className="flex items-center gap-2">
- <OperatingSystem os={info.getValue()} />
- {info.getValue()}
- </div>
- ) : (
- "-"
- ),
- }),
- columnHelper.accessor("device_type", {
- header: "Device",
- cell: (info) => info.getValue() || "Unknown",
- }),
- columnHelper.accessor("referrer", {
- header: "Referrer",
- cell: (info) => info.getValue() || "-",
- }),
- ],
- [site]
- );
-
- // Table instance
- const table = useReactTable({
- data,
- columns,
- getCoreRowModel: getCoreRowModel(),
- });
-
- return (
- <div
- ref={tableContainerRef}
- className="overflow-auto rounded-lg bg-neutral-900 border border-neutral-800"
- style={{ height: "calc(100vh - 200px)" }}
- >
- <table className="min-w-full divide-y divide-neutral-500">
- <thead className="bg-neutral-900 sticky top-0">
- {table.getHeaderGroups().map((headerGroup) => (
- <tr key={headerGroup.id}>
- {headerGroup.headers.map((header) => (
- <th
- key={header.id}
- className="px-4 py-3 text-left font-medium text-gray-400 tracking-wider"
- >
- <div className="flex items-center">
- {flexRender(
- header.column.columnDef.header,
- header.getContext()
- )}
- </div>
- </th>
- ))}
- </tr>
- ))}
- </thead>
- <tbody className="divide-y divide-neutral-650">
- {isLoading ? (
- // Show 10 skeleton rows while loading
- Array.from({ length: 100 }).map((_, index) => (
- <SkeletonRow key={index} columns={columns.length} />
- ))
- ) : data.length === 0 ? (
- <tr>
- <td colSpan={columns.length} className="px-4 py-3">
- <div className="flex justify-center">No sessions found</div>
- </td>
- </tr>
- ) : (
- table.getRowModel().rows.map((row) => {
- return (
- <tr
- key={row.id}
- className="hover:bg-neutral-850 bg-neutral-900 cursor-pointer"
- onClick={() =>
- router.push(`/${site}/user/${row.original.user_id}`)
- }
- >
- {row.getVisibleCells().map((cell) => (
- <td key={cell.id} className="px-4 py-3 whitespace-nowrap">
- {flexRender(
- cell.column.columnDef.cell,
- cell.getContext()
- )}
- </td>
- ))}
- </tr>
- );
- })
- )}
- </tbody>
- </table>
-
- {isFetchingNextPage && (
- <div className="flex justify-center p-4">
- <div className="flex space-x-4">
- <Skeleton className="h-5 w-32" />
- </div>
- </div>
- )}
- </div>
- );
-}
diff --git a/server/src/api/createFunnel.ts b/server/src/api/analytics/createFunnel.ts
similarity index 94%
rename from server/src/api/createFunnel.ts
rename to server/src/api/analytics/createFunnel.ts
index ac0dd1a3c..010bda609 100644
--- a/server/src/api/createFunnel.ts
+++ b/server/src/api/analytics/createFunnel.ts
@@ -1,7 +1,7 @@
import { FastifyRequest, FastifyReply } from "fastify";
-import { db } from "../db/postgres/postgres.js";
-import { reports } from "../db/postgres/schema.js";
-import { getUserHasAccessToSite } from "../lib/auth-utils.js";
+import { db } from "../../db/postgres/postgres.js";
+import { reports } from "../../db/postgres/schema.js";
+import { getUserHasAccessToSite } from "../../lib/auth-utils.js";
import { eq } from "drizzle-orm";
type FunnelStep = {
diff --git a/server/src/api/deleteReport.ts b/server/src/api/analytics/deleteReport.ts
similarity index 87%
rename from server/src/api/deleteReport.ts
rename to server/src/api/analytics/deleteReport.ts
index 5f3d7583c..ef98c326a 100644
--- a/server/src/api/deleteReport.ts
+++ b/server/src/api/analytics/deleteReport.ts
@@ -1,8 +1,8 @@
import { FastifyRequest, FastifyReply } from "fastify";
-import { db } from "../db/postgres/postgres.js";
-import { reports } from "../db/postgres/schema.js";
+import { db } from "../../db/postgres/postgres.js";
+import { reports } from "../../db/postgres/schema.js";
import { eq } from "drizzle-orm";
-import { getUserHasAccessToSite } from "../lib/auth-utils.js";
+import { getUserHasAccessToSite } from "../../lib/auth-utils.js";
export async function deleteReport(
request: FastifyRequest<{
diff --git a/server/src/api/getFunnel.ts b/server/src/api/analytics/getFunnel.ts
similarity index 97%
rename from server/src/api/getFunnel.ts
rename to server/src/api/analytics/getFunnel.ts
index 74d722443..c107612ef 100644
--- a/server/src/api/getFunnel.ts
+++ b/server/src/api/analytics/getFunnel.ts
@@ -1,12 +1,12 @@
import { FastifyRequest } from "fastify";
import { FastifyReply } from "fastify";
-import clickhouse from "../db/clickhouse/clickhouse.js";
+import clickhouse from "../../db/clickhouse/clickhouse.js";
import {
getTimeStatement,
processResults,
getFilterStatement,
} from "./utils.js";
-import { getUserHasAccessToSite } from "../lib/auth-utils.js";
+import { getUserHasAccessToSite } from "../../lib/auth-utils.js";
type FunnelStep = {
value: string;
diff --git a/server/src/api/getFunnels.ts b/server/src/api/analytics/getFunnels.ts
similarity index 90%
rename from server/src/api/getFunnels.ts
rename to server/src/api/analytics/getFunnels.ts
index f911be592..4a745f089 100644
--- a/server/src/api/getFunnels.ts
+++ b/server/src/api/analytics/getFunnels.ts
@@ -1,7 +1,7 @@
import { FastifyRequest, FastifyReply } from "fastify";
-import { db } from "../db/postgres/postgres.js";
-import { reports } from "../db/postgres/schema.js";
-import { getUserHasAccessToSite } from "../lib/auth-utils.js";
+import { db } from "../../db/postgres/postgres.js";
+import { reports } from "../../db/postgres/schema.js";
+import { getUserHasAccessToSite } from "../../lib/auth-utils.js";
import { eq, and } from "drizzle-orm";
export async function getFunnels(
diff --git a/server/src/api/getLiveSessionLocations.ts b/server/src/api/analytics/getLiveSessionLocations.ts
similarity index 94%
rename from server/src/api/getLiveSessionLocations.ts
rename to server/src/api/analytics/getLiveSessionLocations.ts
index 0c6333d2f..274eeb0c8 100644
--- a/server/src/api/getLiveSessionLocations.ts
+++ b/server/src/api/analytics/getLiveSessionLocations.ts
@@ -1,5 +1,5 @@
import { FastifyRequest, FastifyReply } from "fastify";
-import clickhouse from "../db/clickhouse/clickhouse.js";
+import clickhouse from "../../db/clickhouse/clickhouse.js";
import { processResults } from "./utils.js";
export async function getLiveSessionLocations(
diff --git a/server/src/api/getLiveUsercount.ts b/server/src/api/analytics/getLiveUsercount.ts
similarity index 88%
rename from server/src/api/getLiveUsercount.ts
rename to server/src/api/analytics/getLiveUsercount.ts
index e7940388a..0d7021826 100644
--- a/server/src/api/getLiveUsercount.ts
+++ b/server/src/api/analytics/getLiveUsercount.ts
@@ -1,6 +1,6 @@
import { FastifyReply, FastifyRequest } from "fastify";
-import clickhouse from "../db/clickhouse/clickhouse.js";
-import { getUserHasAccessToSite } from "../lib/auth-utils.js";
+import clickhouse from "../../db/clickhouse/clickhouse.js";
+import { getUserHasAccessToSite } from "../../lib/auth-utils.js";
import { processResults } from "./utils.js";
export const getLiveUsercount = async (
diff --git a/server/src/api/getOverview.ts b/server/src/api/analytics/getOverview.ts
similarity index 96%
rename from server/src/api/getOverview.ts
rename to server/src/api/analytics/getOverview.ts
index 7ae7307a0..91d9e22d8 100644
--- a/server/src/api/getOverview.ts
+++ b/server/src/api/analytics/getOverview.ts
@@ -1,11 +1,11 @@
import { FastifyReply, FastifyRequest } from "fastify";
-import clickhouse from "../db/clickhouse/clickhouse.js";
+import clickhouse from "../../db/clickhouse/clickhouse.js";
import {
getFilterStatement,
getTimeStatement,
processResults,
} from "./utils.js";
-import { getUserHasAccessToSite } from "../lib/auth-utils.js";
+import { getUserHasAccessToSite } from "../../lib/auth-utils.js";
import { FilterParameter } from "./types.js";
type GetOverviewResponse = {
diff --git a/server/src/api/getOverviewBucketed.ts b/server/src/api/analytics/getOverviewBucketed.ts
similarity index 97%
rename from server/src/api/getOverviewBucketed.ts
rename to server/src/api/analytics/getOverviewBucketed.ts
index 5fadb07d3..8862434a6 100644
--- a/server/src/api/getOverviewBucketed.ts
+++ b/server/src/api/analytics/getOverviewBucketed.ts
@@ -1,11 +1,11 @@
import { FastifyReply, FastifyRequest } from "fastify";
-import clickhouse from "../db/clickhouse/clickhouse.js";
+import clickhouse from "../../db/clickhouse/clickhouse.js";
import {
getFilterStatement,
getTimeStatement,
processResults,
} from "./utils.js";
-import { getUserHasAccessToSite } from "../lib/auth-utils.js";
+import { getUserHasAccessToSite } from "../../lib/auth-utils.js";
const TimeBucketToFn = {
minute: "toStartOfMinute",
diff --git a/server/src/api/getRetention.ts b/server/src/api/analytics/getRetention.ts
similarity index 97%
rename from server/src/api/getRetention.ts
rename to server/src/api/analytics/getRetention.ts
index 323ebd2fb..71bfdb52a 100644
--- a/server/src/api/getRetention.ts
+++ b/server/src/api/analytics/getRetention.ts
@@ -1,6 +1,6 @@
import { FastifyReply, FastifyRequest } from "fastify";
-import clickhouse from "../db/clickhouse/clickhouse.js";
-import { getUserHasAccessToSite } from "../lib/auth-utils.js";
+import clickhouse from "../../db/clickhouse/clickhouse.js";
+import { getUserHasAccessToSite } from "../../lib/auth-utils.js";
import { processResults } from "./utils.js";
// Define the expected shape of a single data row from the query
diff --git a/server/src/api/getSession.ts b/server/src/api/analytics/getSession.ts
similarity index 96%
rename from server/src/api/getSession.ts
rename to server/src/api/analytics/getSession.ts
index c358147e9..dafb40c24 100644
--- a/server/src/api/getSession.ts
+++ b/server/src/api/analytics/getSession.ts
@@ -1,6 +1,6 @@
import { FastifyReply, FastifyRequest } from "fastify";
-import clickhouse from "../db/clickhouse/clickhouse.js";
-import { getUserHasAccessToSite } from "../lib/auth-utils.js";
+import clickhouse from "../../db/clickhouse/clickhouse.js";
+import { getUserHasAccessToSite } from "../../lib/auth-utils.js";
import { processResults } from "./utils.js";
export interface SessionDetails {
diff --git a/server/src/api/getSessions.ts b/server/src/api/analytics/getSessions.ts
similarity index 95%
rename from server/src/api/getSessions.ts
rename to server/src/api/analytics/getSessions.ts
index 047b93be4..157c66412 100644
--- a/server/src/api/getSessions.ts
+++ b/server/src/api/analytics/getSessions.ts
@@ -1,11 +1,11 @@
import { FastifyReply, FastifyRequest } from "fastify";
-import clickhouse from "../db/clickhouse/clickhouse.js";
+import clickhouse from "../../db/clickhouse/clickhouse.js";
import {
getFilterStatement,
getTimeStatement,
processResults,
} from "./utils.js";
-import { getUserHasAccessToSite } from "../lib/auth-utils.js";
+import { getUserHasAccessToSite } from "../../lib/auth-utils.js";
export type GetSessionsResponse = {
session_id: string;
diff --git a/server/src/api/getSingleCol.ts b/server/src/api/analytics/getSingleCol.ts
similarity index 97%
rename from server/src/api/getSingleCol.ts
rename to server/src/api/analytics/getSingleCol.ts
index f9b5849b9..9799acc74 100644
--- a/server/src/api/getSingleCol.ts
+++ b/server/src/api/analytics/getSingleCol.ts
@@ -1,12 +1,12 @@
import { FastifyReply, FastifyRequest } from "fastify";
-import clickhouse from "../db/clickhouse/clickhouse.js";
+import clickhouse from "../../db/clickhouse/clickhouse.js";
import {
geSqlParam,
getFilterStatement,
getTimeStatement,
processResults,
} from "./utils.js";
-import { getUserHasAccessToSite } from "../lib/auth-utils.js";
+import { getUserHasAccessToSite } from "../../lib/auth-utils.js";
import { FilterParameter } from "./types.js";
interface GenericRequest {
diff --git a/server/src/api/getUserInfo.ts b/server/src/api/analytics/getUserInfo.ts
similarity index 98%
rename from server/src/api/getUserInfo.ts
rename to server/src/api/analytics/getUserInfo.ts
index 590d4a3ee..b8ad4f4ae 100644
--- a/server/src/api/getUserInfo.ts
+++ b/server/src/api/analytics/getUserInfo.ts
@@ -1,5 +1,5 @@
import { FastifyReply, FastifyRequest } from "fastify";
-import { clickhouse } from "../db/clickhouse/clickhouse.js";
+import { clickhouse } from "../../db/clickhouse/clickhouse.js";
import { processResults } from "./utils.js";
interface UserPageviewData {
diff --git a/server/src/api/getUserSessions.ts b/server/src/api/analytics/getUserSessions.ts
similarity index 97%
rename from server/src/api/getUserSessions.ts
rename to server/src/api/analytics/getUserSessions.ts
index 59541721c..df798a7e3 100644
--- a/server/src/api/getUserSessions.ts
+++ b/server/src/api/analytics/getUserSessions.ts
@@ -1,11 +1,11 @@
import { FastifyReply, FastifyRequest } from "fastify";
-import clickhouse from "../db/clickhouse/clickhouse.js";
+import clickhouse from "../../db/clickhouse/clickhouse.js";
import {
getFilterStatement,
getTimeStatement,
processResults,
} from "./utils.js";
-import { getUserHasAccessToSite } from "../lib/auth-utils.js";
+import { getUserHasAccessToSite } from "../../lib/auth-utils.js";
// Individual pageview type
type Pageview = {
diff --git a/server/src/api/types.ts b/server/src/api/analytics/types.ts
similarity index 100%
rename from server/src/api/types.ts
rename to server/src/api/analytics/types.ts
diff --git a/server/src/api/utils.ts b/server/src/api/analytics/utils.ts
similarity index 100%
rename from server/src/api/utils.ts
rename to server/src/api/analytics/utils.ts
diff --git a/server/src/api/createAccount.ts b/server/src/api/user/createAccount.ts
similarity index 97%
rename from server/src/api/createAccount.ts
rename to server/src/api/user/createAccount.ts
index 6cd0c4570..4d993fc8e 100644
--- a/server/src/api/createAccount.ts
+++ b/server/src/api/user/createAccount.ts
@@ -1,5 +1,5 @@
import { FastifyReply, FastifyRequest } from "fastify";
-import { auth } from "../lib/auth.js";
+import { auth } from "../../lib/auth.js";
interface CreateAccountRequest {
Body: {
diff --git a/server/src/api/listOrganizationMembers.ts b/server/src/api/user/listOrganizationMembers.ts
similarity index 94%
rename from server/src/api/listOrganizationMembers.ts
rename to server/src/api/user/listOrganizationMembers.ts
index bb01b3d68..cf7472c07 100644
--- a/server/src/api/listOrganizationMembers.ts
+++ b/server/src/api/user/listOrganizationMembers.ts
@@ -1,8 +1,8 @@
import { FastifyRequest, FastifyReply } from "fastify";
-import { db } from "../db/postgres/postgres.js";
-import { member, user } from "../db/postgres/schema.js";
+import { db } from "../../db/postgres/postgres.js";
+import { member, user } from "../../db/postgres/schema.js";
import { eq, and } from "drizzle-orm";
-import { auth } from "../lib/auth.js";
+import { auth } from "../../lib/auth.js";
interface ListOrganizationMembersRequest {
Params: {
diff --git a/server/src/api/listUsers.ts b/server/src/api/user/listUsers.ts
similarity index 91%
rename from server/src/api/listUsers.ts
rename to server/src/api/user/listUsers.ts
index b3b6ee9b8..04eb9d0e8 100644
--- a/server/src/api/listUsers.ts
+++ b/server/src/api/user/listUsers.ts
@@ -1,5 +1,5 @@
import { FastifyReply, FastifyRequest } from "fastify";
-import { sql } from "../db/postgres/postgres.js";
+import { sql } from "../../db/postgres/postgres.js";
type ListUsersResponse = {
id: string;
diff --git a/server/src/cron/monthly-usage-checker.ts b/server/src/cron/monthly-usage-checker.ts
index c0ac0d0f8..afaa7a414 100644
--- a/server/src/cron/monthly-usage-checker.ts
+++ b/server/src/cron/monthly-usage-checker.ts
@@ -3,7 +3,7 @@ import { clickhouse } from "../db/clickhouse/clickhouse.js";
import { STRIPE_PRICES } from "../lib/const.js";
import { eq, inArray, and } from "drizzle-orm";
import { db } from "../db/postgres/postgres.js";
-import { processResults } from "../api/utils.js";
+import { processResults } from "../api/analytics/utils.js";
// Default event limit for users without an active subscription
const DEFAULT_EVENT_LIMIT = 20_000;
diff --git a/server/src/index.ts b/server/src/index.ts
index ffba807f2..d7da672a6 100644
--- a/server/src/index.ts
+++ b/server/src/index.ts
@@ -6,15 +6,16 @@ import cron from "node-cron";
import { dirname, join } from "path";
import { Headers, HeadersInit } from "undici";
import { fileURLToPath } from "url";
-import { createAccount } from "./api/createAccount.js";
-import { getLiveUsercount } from "./api/getLiveUsercount.js";
-import { getOverview } from "./api/getOverview.js";
-import { getOverviewBucketed } from "./api/getOverviewBucketed.js";
-import { getSessions } from "./api/getSessions.js";
-import { getSession } from "./api/getSession.js";
-import { getSingleCol } from "./api/getSingleCol.js";
-import { getUserSessions } from "./api/getUserSessions.js";
-import { listUsers } from "./api/listUsers.js";
+import { createAccount } from "./api/user/createAccount.js";
+import { getLiveUsercount } from "./api/analytics/getLiveUsercount.js";
+import { getOverview } from "./api/analytics/getOverview.js";
+import { getOverviewBucketed } from "./api/analytics/getOverviewBucketed.js";
+import { getSessions } from "./api/analytics/getSessions.js";
+import { getSession } from "./api/analytics/getSession.js";
+import { getSingleCol } from "./api/analytics/getSingleCol.js";
+import { getUserSessions } from "./api/analytics/getUserSessions.js";
+import { getUsers } from "./api/analytics/getUsers.js";
+import { listUsers } from "./api/user/listUsers.js";
import { addSite } from "./api/sites/addSite.js";
import { changeSiteDomain } from "./api/sites/changeSiteDomain.js";
import { deleteSite } from "./api/sites/deleteSite.js";
@@ -27,17 +28,17 @@ import { allowList, loadAllowedDomains } from "./lib/allowedDomains.js";
import { auth } from "./lib/auth.js";
import { mapHeaders } from "./lib/auth-utils.js";
import { trackEvent } from "./tracker/trackEvent.js";
-import { listOrganizationMembers } from "./api/listOrganizationMembers.js";
+import { listOrganizationMembers } from "./api/user/listOrganizationMembers.js";
import { getUserOrganizations } from "./api/user/getUserOrganizations.js";
import { initializeCronJobs } from "./cron/index.js";
import { getUserSubscription } from "./api/user/getUserSubscription.js";
-import { getUserInfo } from "./api/getUserInfo.js";
-import { getLiveSessionLocations } from "./api/getLiveSessionLocations.js";
-import { getRetention } from "./api/getRetention.js";
-import { getFunnel } from "./api/getFunnel.js";
-import { createFunnel } from "./api/createFunnel.js";
-import { getFunnels } from "./api/getFunnels.js";
-import { deleteReport } from "./api/deleteReport.js";
+import { getUserInfo } from "./api/analytics/getUserInfo.js";
+import { getLiveSessionLocations } from "./api/analytics/getLiveSessionLocations.js";
+import { getRetention } from "./api/analytics/getRetention.js";
+import { getFunnel } from "./api/analytics/getFunnel.js";
+import { createFunnel } from "./api/analytics/createFunnel.js";
+import { getFunnels } from "./api/analytics/getFunnels.js";
+import { deleteReport } from "./api/analytics/deleteReport.js";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
@@ -136,6 +137,7 @@ server.get("/retention/:site", getRetention);
server.get("/site-has-data/:site", getSiteHasData);
server.get("/sessions", getSessions);
server.get("/session/:sessionId", getSession);
+server.get("/users", getUsers);
server.get("/user/:userId/sessions", getUserSessions);
server.get("/user/info/:siteId/:userId", getUserInfo);
server.get("/live-session-locations/:siteId", getLiveSessionLocations);