Click rank
Click rank
Expand the following sections to learn how the average click rank metric is calculated depending on the Coveo API your implementation targets:
Commerce API
The sum of the position values for all click events that followed a request to the Commerce API, divided by the total number of click events that followed a request to the Commerce API.
Requests must be a search, recommendations, or listings request.
SUM (position values for all click events that followed a request to the Commerce API) / SUM (click events that followed a request to the Commerce API)
Search API
The sum of the documentPosition values for all click events that followed a search event, divided by the total number of click events that followed a search event.
SUM (documentPosition values for all click events that followed a search event) / SUM (click events that followed a search event)
This article contains SQL queries to create Snowflake dashboard tiles to report on the following metrics:
To learn how you can create custom dashboards in Snowflake and use the queries listed in this section, see Create Snowflake dashboards.
Click rank per component
The query in this section creates a Snowflake dashboard tile that reports on different Coveo service components.
|
|
Note
A Coveo service component refers to a specific instance exploited by a Coveo service. For example, you can have many components that leverage the Recommendation service:
In this case, the dashboard will report on these three different components. |
The following code sample serves as a base to get the click rank metric for different Coveo components. You can add the required information to this generic version, according to the Coveo service component that you want to report on. However, the required information has been added to the sample queries in the following sections, so we recommend that you try one of them:
set start_timestamp = '<START-DATE>'; -- The start date and time. Replace with the desired timestamp.
set end_timestamp = '<END-DATE>'; -- The end date and time. Replace with the desired timestamp.
with clicked_impressions as (
select
insight_id,
count(distinct click_event_id) as click_count,
sum(position) as click_position_sum
from
COVEO_CORE_MODEL_V001.COMMON.CLICKED_IMPRESSIONS
where
clicked_impression_timestamp between dateadd(day, -2, $start_timestamp :: date) and $end_timestamp
group by
insight_id
),
insights as (
select
insight_id,
{COMPONENT}
from
COVEO_CORE_MODEL_V001.COMMON.INSIGHTS
where
start_time between dateadd(day, -2, $start_timestamp :: date) and $end_timestamp
and insight_type = '{INSIGHT-TYPE}'
)
select
ins.{COMPONENT},
round(
div0(
sum(ci.click_position_sum),
sum(ci.click_count)
),
2
) as click_rank
from
insights ins
left join clicked_impressions ci on ins.insight_id = ci.insight_id
group by
ins.{COMPONENT}
order by
ins.{COMPONENT};
Where you replace:
-
<START-DATE>and<END-DATE>with the start and end dates of the period you want to analyze, in the ISO 8601 format. For example, to analyze data from January 1st, 2025 to January 31st, 2025, you would replace<START-DATE>with2025-01-01and<END-DATE>with2025-01-31. -
{INSIGHT-TYPE}with the Coveo service on which you want to report (that is,search,listing, orrecommendation). -
{COMPONENT}depending on the service you want to report on:Coveo services Value to replace {COMPONENT}withsearchquery_expressionlistingec_listingrecommendationorigin as recommendation_component
Top 10 query expressions
The following query creates a Snowflake dashboard tile that displays the top 10 query expressions that generated the lowest click rank.
set start_timestamp = '<START-DATE>'; -- The start date and time. Replace with the desired timestamp.
set end_timestamp = '<END-DATE>'; -- The end date and time. Replace with the desired timestamp.
with clicked_impressions as (
select
insight_id,
count(distinct click_event_id) as click_count,
sum(position) as click_position_sum
from
COVEO_CORE_MODEL_V001.COMMON.CLICKED_IMPRESSIONS
where
clicked_impression_timestamp between dateadd(day, -2, $start_timestamp :: date) and $end_timestamp
group by
insight_id
),
insights as (
select
insight_id,
lower(query_expression) as query_expression
from
COVEO_CORE_MODEL_V001.COMMON.INSIGHTS
where
start_time between dateadd(day, -2, $start_timestamp :: date) and $end_timestamp
and insight_type = 'search'
and nullif(query_expression, '') is not null
)
select
ins.query_expression,
round(
div0(
sum(ci.click_position_sum),
sum(ci.click_count)
),
2
) as click_rank
from
insights ins
left join clicked_impressions ci on ins.insight_id = ci.insight_id
group by
ins.query_expression
having
click_rank > 0
order by
click_rank asc
limit
10;
-
Replace
<START-DATE>and<END-DATE>with the start and end dates of the period you want to analyze, in the ISO 8601 format. For example, to analyze data from January 1st, 2025 to January 31st, 2025, you would replace<START-DATE>with2025-01-01and<END-DATE>with2025-01-31.
When using the default query, your dashboard should look like the following:
The Chart type, Data, and Appearance sections should look like the following. See Using charts for more information.
Top 10 product listing pages
The following query creates a Snowflake dashboard tile that displays the paths of the top 10 product listing pages that generated the lowest click rank.
set start_timestamp = '<START-DATE>'; -- The start date and time. Replace with the desired timestamp.
set end_timestamp = '<END-DATE>'; -- The end date and time. Replace with the desired timestamp.
with clicked_impressions as (
select
insight_id,
count(distinct click_event_id) as click_count,
sum(position) as click_position_sum
from
COVEO_CORE_MODEL_V001.COMMON.CLICKED_IMPRESSIONS
where
clicked_impression_timestamp between dateadd(day, -2, $start_timestamp :: date) and $end_timestamp
group by
insight_id
),
insights as (
select
ins.insight_id,
con.name as ec_listing
from
COVEO_CORE_MODEL_V001.COMMON.INSIGHTS ins
inner join COVEO_CORE_MODEL_V001.COMMERCE.CONFIGS con on con.config_id = ins.config_id
where
ins.start_time between dateadd(day, -2, $start_timestamp :: date) and $end_timestamp
and ins.insight_type = 'listing'
)
select
ins.ec_listing,
round(
div0(
sum(ci.click_position_sum),
sum(ci.click_count)
),
2
) as click_rank
from
insights ins
left join clicked_impressions ci on ins.insight_id = ci.insight_id
group by
ins.ec_listing
having
click_rank > 0
order by
click_rank asc
limit
10;
-
Replace
<START-DATE>and<END-DATE>with the start and end dates of the period you want to analyze, in the ISO 8601 format. For example, to analyze data from January 1st, 2025 to January 31st, 2025, you would replace<START-DATE>with2025-01-01and<END-DATE>with2025-01-31.
When using the default query, your dashboard should look like the following:
The Chart type, Data, and Appearance sections should look like the following. See Using charts for more information.
Top 10 recommendation components
The following query creates a Snowflake dashboard tile that displays the recommendation components that generated the lowest click rank.
set start_timestamp = '<START-DATE>'; -- The start date and time. Replace with the desired timestamp.
set end_timestamp = '<END-DATE>'; -- The end date and time. Replace with the desired timestamp.
with clicked_impressions as (
select
insight_id,
count(distinct click_event_id) as click_count,
sum(position) as click_position_sum
from
COVEO_CORE_MODEL_V001.COMMON.CLICKED_IMPRESSIONS
where
clicked_impression_timestamp between dateadd(day, -2, $start_timestamp :: date) and $end_timestamp
group by
insight_id
),
insights as (
select
insight_id,
origin as recommendation_component
from
COVEO_CORE_MODEL_V001.COMMON.INSIGHTS
where
start_time between dateadd(day, -2, $start_timestamp :: date) and $end_timestamp
and insight_type = 'recommendation'
)
select
ins.recommendation_component,
round(
div0(
sum(ci.click_position_sum),
sum(ci.click_count)
),
2
) as click_rank
from
insights ins
left join clicked_impressions ci on ins.insight_id = ci.insight_id
group by
ins.recommendation_component
having
click_rank > 0
order by
click_rank asc
limit
10;
-
Replace
<START-DATE>and<END-DATE>with the start and end dates of the period you want to analyze, in the ISO 8601 format. For example, to analyze data from January 1st, 2025 to January 31st, 2025, you would replace<START-DATE>with2025-01-01and<END-DATE>with2025-01-31.
When using the default query, your dashboard should look like the following:
The Chart type, Data, and Appearance sections should look like the following. See Using charts for more information.