Add goal management functionality in analytics (#100)

* Add goal management functionality in analytics

- Introduced goal creation, deletion, and updating capabilities in the analytics API, allowing users to define conversion goals based on path or event types.
- Implemented corresponding React hooks for managing goals, including fetching, creating, updating, and deleting goals.
- Enhanced the UI with a dedicated Goals page and components for listing and managing goals, improving user experience in tracking conversions.
- Updated package dependencies to include necessary libraries for form handling and validation.

* Enhance goals management with pagination and sorting

- Added pagination and sorting capabilities to the goals fetching logic in the analytics API, allowing users to navigate through goals more efficiently.
- Updated the GoalsPage component to manage current page state and handle page changes, improving user experience.
- Modified the GoalsList component to display pagination metadata and navigation controls, facilitating better goal management.
- Adjusted the server-side getGoals function to support pagination and sorting parameters, ensuring accurate data retrieval.

* Refactor GoalsPage and GoalCard components for improved UI and functionality

- Updated GoalsPage to include a SubHeader component and adjusted layout for better responsiveness.
- Enhanced loading and empty state handling in GoalsPage for a smoother user experience.
- Modified GoalCard to use icons for goal types, improving visual clarity and consistency in the UI.

* Refactor CreateGoalButton and GoalCard components for improved modal handling

- Updated CreateGoalButton to utilize a trigger prop for the GoalFormModal, simplifying modal state management.
- Refactored GoalCard to integrate GoalFormModal for editing goals, enhancing user interaction and reducing state complexity.
- Removed unnecessary state management and modal handling from both components, streamlining the codebase.

* Refactor GoalCard and Clickhouse initialization for improved code clarity

- Removed unnecessary imports in GoalCard component, streamlining the code.
- Updated Clickhouse initialization to include a new 'props' JSON field alongside 'properties', enhancing data structure for analytics.
- Added a utility function in PageviewQueue to parse properties, improving error handling and data integrity.

* enable clickhouse

* fix ch build

* fix ch build

* fix ch build

* wip

* wip

* wip

* Enable json

* add network

* add network

* Refactor Clickhouse configuration and remove unused properties from data models

* Refactor property value handling in analytics queries to utilize native JSON types in ClickHouse, improving type safety and performance.
This commit is contained in:
Bill Yang 2025-04-28 20:58:43 -07:00 committed by GitHub
parent db1bbe2fb1
commit ca0faeb484
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
28 changed files with 2293 additions and 72 deletions

View file

@ -18,6 +18,14 @@ type TotalPayload = TrackingPayload & {
properties?: string;
};
const getParsedProperties = (properties: string | undefined) => {
try {
return properties ? JSON.parse(properties) : undefined;
} catch (error) {
return undefined;
}
};
class PageviewQueue {
private queue: TotalPayload[] = [];
private batchSize = 5000;
@ -104,7 +112,7 @@ class PageviewQueue {
lon: longitude || 0,
type: pv.type || "pageview",
event_name: pv.event_name || "",
properties: pv.properties,
props: getParsedProperties(pv.properties),
utm_source: utmParams["utm_source"] || "",
utm_medium: utmParams["utm_medium"] || "",
utm_campaign: utmParams["utm_campaign"] || "",