One of the identified metric tiles for the ACR epic is Top pages driving leads. Details of this metric tile are as follows:
Description: Total number of lead form submissions for top traffic source. We will extract only the top performing one and show it in the existing numeric tile template (like what we have for the existing “Top traffic source” KM tile). Tile should combine counts from both contact and submit_lead_form events, if present, otherwise, it will use the data for events that are present.
Events: generate_leadsubmit_lead_form and contactMetrics: Total generate_leadsubmit_lead_form and contact events count, ordered by sessionDefaultChannelGroup dimension, returning the 1st item from results
Dimension: sessionDefaultChannelGroupOrder: Descending
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
A new Top traffic source driving leads ACR widget is introduced to the existing list of widgets available within KMW
Widget displays the percentage of generate_lead|submit_lead_form|contact event count for the sessionDefaultChannelGroup dimension (using the 1st/top channel from the results)
Total number of leads for the top traffic source should be used for description and the tootlip
Widget will not be displayed, or shown in the selection panel list if none of the above listed event names are present, or conversionReporting feature flag is not enabled
Register new widget for KM_ANALYTICS_TOP_TRAFFIC_SOURCE_DRIVING_LEADS
Use "Top traffic source driving leads" for title
Use "Total number of leads for the top traffic source" for description and tooltip
Include new property requiredConversionEventName, and assign it an array value containing following event names: submit_lead_form, contact and generate_lead
In displayInList pass the helper function shouldDisplayWidgetWithConversionEvent
You can use assets/js/modules/analytics-4/components/widgets/TopTrafficSourceWidget.js as a starting point
Include showWidget const which should hold value of isKeyMetricActive or if no event is present in the inline data (the condition used in shouldDisplayWidgetWithConversionEvent helper function), so this const can be used to return WidgetNull and prevent report requests if conditions are not met. You can see example usage of this const in assets/js/modules/analytics-4/components/widgets/PopularProductsWidget.js
In totalLeadsReportOptions:
Use eventCount for metrics
Use eventName dimension
Include dimensionFilters for eventName dimension. Use inListFilter for filterType and for the value include the detected event name by cross-referencing the recentEvents inline data returned from selector implemented in #9132 with - ['submit_lead_form', 'contact', 'generate_lead']. In case both contact and submit_lead_form are detected, use only submit_lead_form, to cover the cases where users have both Popup Maker and Contact Form 7 plugins installed, as both events would be tracked, making them duplicate.
You can see an example of how is inListFilter filter used in assets/js/modules/analytics-4/components/widgets/TopRecentTrendingPagesWidget.js
In trafficSourceReportOptions:
Use sessionDefaultChannelGroup and eventName for dimensions
Use eventCount metric
Use same dimensionFilters as in previous report options
[ ] Update assets/js/modules/analytics-4/index.js to include new widget registration
Test Coverage
Add stories for the new widget
QA Brief
Setup Site Kit with Analytics module
Contact Aleksej for access to the website with ACR data
Verify that in key metrics selection panel Top traffic source driving leads widget is not available
Enable conversionReporting feature flag
Go to key metrics selection panel and choose Top traffic source driving leads tile
Verify it widget is showing data, and matching the figma design
Go to analytics settings - switch to different account/property, and verify that Top traffic source driving leads widget is not available (since widget will only be visible on property that has ACR data)
Feature Description
One of the identified metric tiles for the ACR epic is Top pages driving leads. Details of this metric tile are as follows:
Description: Total number of lead form submissions for top traffic source. We will extract only the top performing one and show it in the existing numeric tile template (like what we have for the existing “Top traffic source” KM tile). Tile should combine counts from both contact and submit_lead_form events, if present, otherwise, it will use the data for events that are present. Events:
generate_lead
submit_lead_form
andcontact
Metrics: Totalgenerate_lead
submit_lead_form
andcontact
events count, ordered bysessionDefaultChannelGroup
dimension, returning the 1st item from results Dimension:sessionDefaultChannelGroup
Order: DescendingDo not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Top traffic source driving leads
ACR widget is introduced to the existing list of widgets available within KMWgenerate_lead
|submit_lead_form
|contact
event count for thesessionDefaultChannelGroup
dimension (using the 1st/top channel from the results)Total number of leads for the top traffic source
should be used for description and the tootlipconversionReporting
feature flag is not enabledImplementation Brief
assets/js/googlesitekit/datastore/user/constants.js
KM_ANALYTICS_TOP_TRAFFIC_SOURCE_DRIVING_LEADS
, holding a stringkmAnalyticsTopTrafficSourceDrivingLeads
assets/js/components/KeyMetrics/key-metrics-widgets.js
KM_ANALYTICS_TOP_TRAFFIC_SOURCE_DRIVING_LEADS
title
description
andtooltip
requiredConversionEventName
, and assign it an array value containing following event names:submit_lead_form
,contact
andgenerate_lead
displayInList
pass the helper functionshouldDisplayWidgetWithConversionEvent
assets/js/modules/analytics-4/components/widgets/TopTrafficSourceDrivingLeads.js
assets/js/modules/analytics-4/components/widgets/TopTrafficSourceWidget.js
as a starting pointshowWidget
const which should hold value ofisKeyMetricActive
or if no event is present in the inline data (the condition used inshouldDisplayWidgetWithConversionEvent
helper function), so this const can be used to returnWidgetNull
and prevent report requests if conditions are not met. You can see example usage of this const inassets/js/modules/analytics-4/components/widgets/PopularProductsWidget.js
totalLeadsReportOptions
:eventCount
for metricseventName
dimensiondimensionFilters
foreventName
dimension. UseinListFilter
forfilterType
and for thevalue
include the detected event name by cross-referencing therecentEvents
inline data returned from selector implemented in #9132 with -['submit_lead_form', 'contact', 'generate_lead']
. In case bothcontact
andsubmit_lead_form
are detected, use onlysubmit_lead_form
, to cover the cases where users have both Popup Maker and Contact Form 7 plugins installed, as both events would be tracked, making them duplicate.inListFilter
filter used inassets/js/modules/analytics-4/components/widgets/TopRecentTrendingPagesWidget.js
trafficSourceReportOptions
:sessionDefaultChannelGroup
andeventName
for dimensionseventCount
metricdimensionFilters
as in previous report optionsassets/js/modules/analytics-4/index.js
to include new widget registrationTest Coverage
QA Brief
Top traffic source driving leads
widget is not availableconversionReporting
feature flagTop traffic source driving leads
tileTop traffic source driving leads
widget is not available (since widget will only be visible on property that has ACR data)Changelog entry