MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / getGscPages

Function getGscPages

packages/db/src/gsc.ts:338–373  ·  view source on GitHub ↗
(
  projectId: string,
  startDate: string,
  endDate: string,
  limit = 100
)

Source from the content-addressed store, hash-verified

336}
337
338export async function getGscPages(
339 projectId: string,
340 startDate: string,
341 endDate: string,
342 limit = 100
343): Promise<
344 Array<{
345 page: string;
346 clicks: number;
347 impressions: number;
348 ctr: number;
349 position: number;
350 }>
351> {
352 const result = await originalCh.query({
353 query: `
354 SELECT
355 page,
356 sum(clicks) as clicks,
357 sum(impressions) as impressions,
358 avg(ctr) as ctr,
359 avg(position) as position
360 FROM gsc_pages_daily
361 FINAL
362 WHERE project_id = {projectId: String}
363 AND date >= {startDate: String}
364 AND date <= {endDate: String}
365 GROUP BY page
366 ORDER BY clicks DESC
367 LIMIT {limit: UInt32}
368 `,
369 query_params: { projectId, startDate, endDate, limit },
370 format: 'JSONEachRow',
371 });
372 return result.json();
373}
374
375export interface GscCannibalizedQuery {
376 query: string;

Callers 3

registerGscPageToolsFunction · 0.90
gscGetTopPagesCoreFunction · 0.90
gsc.tsFile · 0.90

Calls 1

queryMethod · 0.80

Tested by

no test coverage detected