Skip to main content

Migrating from Reports to ReportStats

Differences between Report and ReportStat

Report and ReportStat mostly share the same fields. The main difference is that the Report type represents a single ReportType (e.g. Added) and ReportStat contains the data for all available ReportTypes (Basic, Added, Missing and Removed).

Because of that, all fields which access URL data or rely on ReportType accept an additional reportType argument. By default, those fields return the data for the Basic ReportType and the argument is required only if you need to access non-Basic ReportType data.

The total number of URLs, available under the Report totalRows field, can be accessed on ReportStat using fields named after ReportType. For example, to get the equivalent of the URLs count in a Removed Report you would retrieve the removed field on ReportStat.

ReportStat provides streamlined and faster access to your data but does not have the same filtering and sorting capabilities as Report.

For detailed examples and side-by-side comparisons, see the sections below.

Examples

getReport vs getReportStat

A single ReportStat with URL data can be retrieved by crawl ID and ReportTemplate code. Same as getReport, getReportStat accepts an optional segmentId argument as part of the input.

query GetReport($input: GetReportInputType!) {
getReport(input: $input) {
crawlId
reportTemplateCode
reportTypeCodeEnum
totalRows
crawlUrls {
nodes {
url
# ...other metrics
}
}
}
}
query GetReportStat($input: GetReportStatInput!) {
getReportStat(input: $input) {
crawlId
reportTemplateCode
basic
crawlUrls {
nodes {
url
# ...other metrics
}
}
}
}

getReportsForCrawls vs getReportStats

A multiple ReportStats can be retrieved by crawl ID and ReportTemplate code pairs. Additionally, an optional segmentId argument can be provided as part of each input object.

query GetReportsForCrawls(
$crawlIds: [ObjectID!]!
$filter: ReportConnectionFilterInput
) {
getReportsForCrawls(crawlIds: $crawlIds, filter: $filter) {
nodes {
crawlId
reportTemplateCode
reportTypeCodeEnum
totalRows
}
}
}
query GetReportStats($inputs: [GetReportStatInput!]!) {
getReportStats(inputs: $inputs) {
crawlId
reportTemplateCode
added
}
}

Crawl.reportsByCode vs Crawl.reportStats

By default, Crawl.reportStats field returns all available ReportStats. They can be filtered by providing an optional reportTemplateCodes argument. Same as the top-level queries from previous examples, an optional segmentId argument is also accepted.

query GetCrawlReportsByCode(
$crawlId: ObjectID!
$input: CrawlReportsByCodeInput!
) {
getCrawl(id: $crawlId) {
reportsByCode(input: $input) {
crawlId
reportTemplateCode
totalRows
}
}
}
query GetCrawlReportStats(
$crawlId: ObjectID!
$reportTemplateCodes: [String!]
) {
getCrawl(id: $crawlId) {
reportStats(reportTemplateCodes: $reportTemplateCodes) {
crawlId
reportTemplateCode
basic
}
}
}

Crawl.reports vs Crawl.reportStats

Crawl.reportStats field does not provide the same filtering capabilities as Crawl.reports field. It can only be filtered by providing an optional reportTemplateCodes argument as shown in the previous example. It also doesn't have any sorting capabilities. If required, additional filtering or sorting would have to be done on the client side after retrieving all ReportStats.