feat: referral traffic endpoints follow up | LLMO-4261#2301
Open
feat: referral traffic endpoints follow up | LLMO-4261#2301
Conversation
Updated the maximum page size limit from 500 to 1000 in the referral traffic controller and corresponding test to accommodate larger data requests.
- Introduced a mapping for referral traffic sources to their respective database tables. - Updated the `withReferralTrafficAuth` function to handle site access validation without storing the context. - Modified the `createReferralTrafficWeeksHandler` to query the correct table based on the provided source. - Added validation to return a 400 error for unsupported sources in the business impact endpoint. - Updated tests to verify new source handling and default behavior.
…etrics - Introduced a new endpoint `GET /sites/:siteId/referral-traffic/by-device` to fetch referral traffic data categorized by device type. - Updated existing referral traffic handlers to include additional metrics such as entries, exits, average time on site, and revenue for better insights. - Enhanced test cases to validate the new endpoint and updated metrics in the response structure.
…r optional fields - Added new test cases to validate the mapping of optional numeric fields in the referral traffic handlers, ensuring accurate data representation for various metrics including entries, exits, and revenue. - Updated existing tests to cover scenarios where non-null values are provided, improving overall test coverage and reliability.
|
This PR will trigger a minor release when merged. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
ekremney
approved these changes
Apr 30, 2026
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.
Description
Extend referral traffic API with device breakdown and additional metrics
Adds a new /by-device endpoint and extends several existing referral traffic
endpoints with additional metrics to achieve parity with the legacy non-PG dashboard.
New endpoint:
by device type across all four sources (optel, cdn, ga4, adobe_analytics)
Extended endpoints:
pagesPerVisit, orders, conversionRate per weekly bucket
page intent now resolved via the page_intents lookup table using path-based matching
on the stale page_intent column in traffic tables
Sort support: entries, exits, avg_time_on_site, revenue added to allowed sort columns
for /by-url.
Tests updated to cover new fields and the new /by-device route.
Please ensure your pull request adheres to the following guidelines:
describe here the problem you're solving.
If the PR is changing the API specification:
yet. Ideally, return a 501 status code with a message explaining the feature is not implemented yet.
If the PR is changing the API implementation or an entity exposed through the API:
If the PR is introducing a new audit type:
Related Issues
LLMO-4261