Conversation
…tics in SiteDashboardPage
…and documentation link for tracking marketing campaigns
Greptile OverviewGreptile SummaryThis PR adds a new Campaigns section to the site dashboard for tracking marketing performance via UTM parameters ( Key Changes:
Implementation Quality: Confidence Score: 4.5/5
|
| Filename | Overview |
|---|---|
| components/dashboard/Campaigns.tsx | New component displaying campaign statistics with UTM parameter data; includes modal view and helpful empty state guidance |
| lib/api/stats.ts | Added getCampaigns and getPublicCampaigns API functions with proper TypeScript typing and URLSearchParams handling |
| app/sites/[id]/page.tsx | Integrated Campaigns component into dashboard layout between TechSpecs and GoalStats sections |
Sequence Diagram
sequenceDiagram
participant User
participant Dashboard as SiteDashboardPage
participant Campaigns as Campaigns Component
participant API as stats.ts API Client
participant Backend as Backend API
User->>Dashboard: Navigate to /sites/[id]
Dashboard->>Campaigns: Render <Campaigns siteId dateRange />
activate Campaigns
Campaigns->>API: getCampaigns(siteId, start, end, 10)
API->>Backend: GET /sites/{siteId}/campaigns?start_date&end_date&limit=10
Backend-->>API: { campaigns: CampaignStat[] }
API-->>Campaigns: CampaignStat[]
Campaigns->>Campaigns: setData(result)
Campaigns-->>User: Display campaign table or empty state
deactivate Campaigns
opt User clicks "View All"
User->>Campaigns: Click "View All" button
Campaigns->>Campaigns: setIsModalOpen(true)
activate Campaigns
Campaigns->>API: getCampaigns(siteId, start, end, 100)
API->>Backend: GET /sites/{siteId}/campaigns?start_date&end_date&limit=100
Backend-->>API: { campaigns: CampaignStat[] }
API-->>Campaigns: CampaignStat[]
Campaigns->>Campaigns: setFullData(result)
Campaigns-->>User: Display modal with full data
deactivate Campaigns
end
…ampaigns component to utilize it for fetching data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Work Item
PULSE-11
Summary
Added a new "Campaigns" section to the site dashboard to visualize marketing performance based on UTM parameters.
Changes
Campaignscomponent to display a list of campaigns (Source, Medium, Campaign) with visitor counts.Campaignscomponent into the main site dashboard (/sites/[id]).getCampaignsfunction to fetch data from the new backend endpoint.Test Plan
[ ] Visit a site dashboard with existing campaign data and verify the table renders correctly.
[ ] Visit a site dashboard with NO campaign data and verify the empty state (megaphone icon + instructions) appears.
[ ] Click "View All" (if enough data exists) to verify the modal opens and displays the full list.