Skip to content
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
3a537c8
fix: adding agentic urls
anuj-adobe Nov 18, 2025
8453085
temp: reducing urls for testings
anuj-adobe Nov 18, 2025
e2347b9
Merge branch 'main' into prerender
anuj-adobe Nov 18, 2025
0beac30
fix: adding debug statements for athena queries
anuj-adobe Nov 18, 2025
756d587
fix: extracting agentic urls from sheet
anuj-adobe Nov 18, 2025
4a920ef
fix: using athena query for agentic urls
anuj-adobe Nov 19, 2025
25f645b
temp: increasing agentic urls limit to 50
anuj-adobe Nov 19, 2025
c422540
fix: update traffic for includedURLs
anuj-adobe Nov 19, 2025
e5668b2
fix: removing unwanted test
anuj-adobe Nov 19, 2025
bd6a86d
fix: return auditResult and fullAuditRef in first step
anuj-adobe Nov 19, 2025
1613fc1
Merge branch 'main' into prerender
anuj-adobe Nov 24, 2025
68c4f5f
fix: adding a sheet fallback for agentic urls
anuj-adobe Nov 24, 2025
890b3a4
temp: reducing urls limit to 10 for testing
anuj-adobe Nov 24, 2025
e34ee7c
temp: getTopAgenticUrlsFromSheet
anuj-adobe Nov 24, 2025
be156d5
fix: refactoring
anuj-adobe Nov 24, 2025
2129e25
fix: trafficDuration as object
anuj-adobe Nov 24, 2025
c386d20
fix: adding tests
anuj-adobe Nov 24, 2025
fcfee80
fix: syncing with main
anuj-adobe Nov 24, 2025
76e8d7d
fix: upload summary should include trafficDuration
anuj-adobe Nov 24, 2025
df2e499
fix: sheet fallback to fetch agenticTraffic for includedURLs
anuj-adobe Nov 25, 2025
311a9a5
fix: adding ahref top 200 pages back
anuj-adobe Nov 25, 2025
23b1d55
fix: removing saving traffic and duration in suggestion
anuj-adobe Nov 25, 2025
8164bd5
fix: athena query for last 4 weeks
anuj-adobe Nov 25, 2025
8aa549b
fix: prerender test
anuj-adobe Nov 25, 2025
f628b58
Merge branch 'main' into prerender
anuj-adobe Nov 26, 2025
28c2d46
trivial: comment changes
anuj-adobe Nov 26, 2025
af55693
fix: updating agentic urls query
anuj-adobe Nov 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"scripts": {
"start": "nodemon",
"test": "c8 mocha -i -g 'Post-Deploy' --spec=test/**/*.test.js",
"test": "c8 mocha --grep='DO_NOT_RUN' --spec=test/**/*.test.js",
"test-postdeploy": "mocha -g 'Post-Deploy' --spec=test/**/*.test.js",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
Expand Down
8 changes: 8 additions & 0 deletions src/cdn-logs-report/sql/agentic-hits-for-urls.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
SELECT
url,
SUM(number_of_hits) AS number_of_hits
FROM {{databaseName}}.{{tableName}}
{{whereClause}}
AND url IN ({{urlList}})
GROUP BY url;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as there can be so many urls,
use limit 200 and orderby number_of_hits DESC here

Copy link
Contributor Author

@anuj-adobe anuj-adobe Nov 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This query is required to find the agentic traffic for URLs that are added over top 200 agentic URLs (by updating site config for prerender handler using "includedURLs"). The extra added URLs might not be present in top 200 URLs. I don't think limit 200 will help in this case and we need to scan all the URLs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed this file.


32 changes: 32 additions & 0 deletions src/cdn-logs-report/utils/query-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,40 @@ async function createTopUrlsQuery(options) {
});
}

/**
* Build an Athena query to fetch agentic hits for a specific set of URL paths.
* The passed urlPaths should be path-only (e.g., "/foo/bar"), matching the "url" field in logs.
*/
export async function createAgenticHitsForUrlsQuery(options) {
const {
periods, databaseName, tableName, site, urlPaths,
} = options;

const filters = site.getConfig().getLlmoCdnlogsFilter();
const siteFilters = buildSiteFilters(filters, site);
const lastWeek = periods.weeks[periods.weeks.length - 1];
const whereClause = buildWhereClause(
[buildDateFilter(lastWeek.startDate, lastWeek.endDate)],
siteFilters,
);

// Escape single quotes inside paths for SQL safety
const escapeSql = (s) => String(s).replace(/'/g, "''");
const urlList = urlPaths && urlPaths.length > 0
? urlPaths.map((p) => `'${escapeSql(p)}'`).join(', ')
: ''; // will produce empty IN() which returns no results

return loadSql('agentic-hits-for-urls', {
databaseName,
tableName,
whereClause,
urlList,
});
}

export const weeklyBreakdownQueries = {
createAgenticReportQuery,
createReferralReportQuery,
createTopUrlsQuery,
createAgenticHitsForUrlsQuery,
};
Loading