Clickthrough rate (CTR)
Clickthrough rate (CTR)
Expand the following sections to learn how the average clickthrough rate metric is calculated depending on the Coveo API your implementation targets:
Commerce API
The sum of the requests to the Commerce API that were followed by at least one click event (with a matching unique identifier value), divided by the total number of search requests to the Commerce API.
Requests must be either a search, a recommendations, or a listings request.
SUM (requests to the Commerce API followed by a click event) / SUM (requests to the Commerce API)
Search API
The sum of the search events that were followed by at least one click event (with a matching unique identifier value), divided by the total number of search events.
SUM (search events followed by a click event) / SUM (search events)
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.
CTR 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 CTR 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
distinct insight_id
from
COVEO_CORE_MODEL_V001.COMMON.CLICKED_IMPRESSIONS
where
clicked_impression_timestamp between dateadd(day, -2, $start_timestamp :: date) and $end_timestamp
),
insights as (
select
insight_id,
{COMPONENT}
from
COVEO_CORE_MODEL_V001.COMMON.INSIGHTS ins
where
start_time between dateadd(day, -2, $start_timestamp :: date) and $end_timestamp
)
select
ins.{COMPONENT},
round(
div0(
count(distinct ci.insight_id),
count(distinct ins.insight_id)
) * 100,
2
) as click_through_rate
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. -
{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 highest CTR.
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
distinct insight_id
from
COVEO_CORE_MODEL_V001.COMMON.CLICKED_IMPRESSIONS
where
clicked_impression_timestamp between dateadd(day, -2, $start_timestamp :: date) and $end_timestamp
),
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 nullif(query_expression, '') is not null
and insight_type = 'search'
)
select
ins.query_expression,
round(
div0(
count(distinct ci.insight_id),
count(distinct ins.insight_id)
) * 100,
2
) as click_through_rate
from
insights ins
left join clicked_impressions ci on ins.insight_id = ci.insight_id
group by
ins.query_expression
order by
click_through_rate desc
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 highest CTR.
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
distinct insight_id
from
COVEO_CORE_MODEL_V001.COMMON.CLICKED_IMPRESSIONS
where
clicked_impression_timestamp between dateadd(day, -2, $start_timestamp :: date) and $end_timestamp
),
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(
count(distinct ci.insight_id),
count(distinct ins.insight_id)
) * 100,
2
) as click_through_rate
from
insights ins
left join clicked_impressions ci on ins.insight_id = ci.insight_id
group by
ins.ec_listing
order by
click_through_rate desc
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 highest CTR.
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
distinct insight_id
from
COVEO_CORE_MODEL_V001.COMMON.CLICKED_IMPRESSIONS
where
clicked_impression_timestamp between dateadd(day, -2, $start_timestamp :: date) and $end_timestamp
),
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(
count(distinct ci.insight_id),
count(distinct ins.insight_id)
) * 100,
2
) as click_through_rate
from
insights ins
left join clicked_impressions ci on ins.insight_id = ci.insight_id
group by
ins.recommendation_component
order by
click_through_rate desc
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.