-
Notifications
You must be signed in to change notification settings - Fork 293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create the "Top converting traffic source" key metric widget tile. #7253
Create the "Top converting traffic source" key metric widget tile. #7253
Conversation
Build files for d4f9491 have been deleted. |
Size Change: +514 B (0%) Total Size: 1.39 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @techanvil – this LGTM, just a few small observations.
@@ -37,14 +49,92 @@ export default function TopConvertingTrafficSourceWidget( { | |||
select( CORE_USER ).isKeyMetricsWidgetHidden() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This must have been scaffolded before, but there is a utility used by other widget tiles to simplify this which also prevents side effects from the widget rendering without the need to have conditional selects
site-kit-wp/assets/js/modules/analytics-4/components/widgets/LoyalVisitorsWidget.js
Line 128 in 96cf061
export default whenKeyMetricsWidgetVisible()( LoyalVisitorsWidget ); |
It might not be worth changing at this point as this should be covered by #7061
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @aaemnnosttv, that's useful to know. It does seem this should conceptually be covered by #7061, but looking at the IB, it only specifies the removal of the whenKeyMetricsWidgetVisible
HOC, with the only reference to keyMetricsWidgetHidden
being in a struck-out line.
Noting that there are other widgets currently doing a similar check with isKeyMetricsWidgetHidden()
, and furthermore that #7061 is currently in execution with @jimmymadon, I'd say it's probably not worth updating this widget, but rather getting it merged while Jimmy's still working on #7061, and dropping him a line to make sure he merges develop
into his branch and updates all of these widgets to remove the checks based on isKeyMetricsWidgetHidden()
.
$ grep -l isKeyMetricsWidgetHidden assets/js/**/*Widget.js
assets/js/modules/analytics-4/components/widgets/EngagedTrafficSourceWidget.js
assets/js/modules/analytics-4/components/widgets/PopularProductsWidget.js
assets/js/modules/analytics-4/components/widgets/TopCitiesWidget.js
assets/js/modules/analytics-4/components/widgets/TopConvertingTrafficSourceWidget.js
assets/js/modules/analytics-4/components/widgets/TopCountriesWidget.js
assets/js/modules/analytics-4/components/widgets/TopTrafficSourceWidget.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah - actually, I should have looked into #7061 a bit more deeply, I've now seen there's an open PR in which @jimmymadon is already addressing those isKeyMetricsWidgetHidden()
checks in the other widgets. So this really just becomes a question about timing and if it makes sense to merge this PR while #7061 is in progress...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update: Having spoken to Jimmy on Slack he's happy to take the approach of merging develop
into his branch once this one's merged, and updating this component along with the others.
assets/js/modules/analytics-4/components/widgets/TopConvertingTrafficSourceWidget.stories.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @techanvil – this looks good, however I'm seeing some strange results in my testing. I think you'll see what I mean
Looking at the report data, the metric values for the rows
are always 1
, but the totals
show something a bit more variable and realistic. Should we be using totals
instead for the percentages?
Thanks for pointing this out @aaemnnosttv. As discussed, the values do change when selecting the 90 day date range, which suggests that they may indeed be correct; however I've not managed to come to a definitive conclusion about the Referring to the example reports below, note the One further note - as far as I can see we don't have access to metrics that would allows us to manually calculate these totals - there is no session dimension that would allow us to break down conversion by session that I can see although there could of course be something I am missing here. As implied above, the report does provide a different value for top channel group in the 90 day report, where the My feeling here is that we should probably trust the value of the top channel group, seeing as it does differ across date ranges and the total value (that we're not using anyway) is slightly unclear and not changing across differing sets of rows in the reports. However it does leave me a little unsettled not knowing why these totals are behaving as they are. It might be worth looping Mariya into the conversation to see if she could provide a bit more clarity. What do you think? Previous 28 days, limit 1Request:{
"dateRanges": [
{
"endDate": "2023-07-09",
"startDate": "2023-06-12"
},
{
"endDate": "2023-06-11",
"startDate": "2023-05-15"
}
],
"dimensions": [
{
"name": "sessionDefaultChannelGroup"
}
],
"keepEmptyRows": true,
"limit": 1,
"metricAggregations": [
"TOTAL",
"MINIMUM",
"MAXIMUM"
],
"metrics": [
{
"name": "sessionConversionRate"
}
],
"property": "properties/285794360"
} Response:{
"dimensionHeaders": [
{
"name": "sessionDefaultChannelGroup"
},
{
"name": "dateRange"
}
],
"metricHeaders": [
{
"name": "sessionConversionRate",
"type": "TYPE_FLOAT"
}
],
"rows": [
{
"dimensionValues": [
{
"value": "Organic Social"
},
{
"value": "date_range_0"
}
],
"metricValues": [
{
"value": "1"
}
]
},
{
"dimensionValues": [
{
"value": "Organic Social"
},
{
"value": "date_range_1"
}
],
"metricValues": [
{
"value": "1"
}
]
}
],
"totals": [
{
"dimensionValues": [
{
"value": "RESERVED_TOTAL"
},
{
"value": "date_range_0"
}
],
"metricValues": [
{
"value": "0.98451566438602811"
}
]
},
{
"dimensionValues": [
{
"value": "RESERVED_TOTAL"
},
{
"value": "date_range_1"
}
],
"metricValues": [
{
"value": "0.9842903575297941"
}
]
}
],
"maximums": [
{
"dimensionValues": [
{
"value": "RESERVED_MAX"
},
{
"value": "date_range_0"
}
],
"metricValues": [
{
"value": "1"
}
]
},
{
"dimensionValues": [
{
"value": "RESERVED_MAX"
},
{
"value": "date_range_1"
}
],
"metricValues": [
{
"value": "1"
}
]
}
],
"minimums": [
{
"dimensionValues": [
{
"value": "RESERVED_MIN"
},
{
"value": "date_range_0"
}
],
"metricValues": [
{
"value": "0.3625"
}
]
},
{
"dimensionValues": [
{
"value": "RESERVED_MIN"
},
{
"value": "date_range_1"
}
],
"metricValues": [
{
"value": "0.076923076923076927"
}
]
}
],
"rowCount": 6,
"metadata": {
"currencyCode": "USD",
"timeZone": "America/Los_Angeles"
},
"kind": "analyticsData#runReport"
}
Previous 28 days, no limitRequest: {
"dateRanges": [
{
"endDate": "2023-07-09",
"startDate": "2023-06-12"
},
{
"endDate": "2023-06-11",
"startDate": "2023-05-15"
}
],
"dimensions": [
{
"name": "sessionDefaultChannelGroup"
}
],
"keepEmptyRows": true,
"metricAggregations": [
"TOTAL",
"MINIMUM",
"MAXIMUM"
],
"metrics": [
{
"name": "sessionConversionRate"
}
],
"property": "properties/285794360"
} Response:{
"dimensionHeaders": [
{
"name": "sessionDefaultChannelGroup"
},
{
"name": "dateRange"
}
],
"metricHeaders": [
{
"name": "sessionConversionRate",
"type": "TYPE_FLOAT"
}
],
"rows": [
{
"dimensionValues": [
{
"value": "Organic Search"
},
{
"value": "date_range_1"
}
],
"metricValues": [
{
"value": "1"
}
]
},
{
"dimensionValues": [
{
"value": "Organic Social"
},
{
"value": "date_range_0"
}
],
"metricValues": [
{
"value": "1"
}
]
},
{
"dimensionValues": [
{
"value": "Organic Social"
},
{
"value": "date_range_1"
}
],
"metricValues": [
{
"value": "1"
}
]
},
{
"dimensionValues": [
{
"value": "Organic Video"
},
{
"value": "date_range_0"
}
],
"metricValues": [
{
"value": "1"
}
]
},
{
"dimensionValues": [
{
"value": "Organic Video"
},
{
"value": "date_range_1"
}
],
"metricValues": [
{
"value": "1"
}
]
},
{
"dimensionValues": [
{
"value": "Referral"
},
{
"value": "date_range_0"
}
],
"metricValues": [
{
"value": "1"
}
]
},
{
"dimensionValues": [
{
"value": "Referral"
},
{
"value": "date_range_1"
}
],
"metricValues": [
{
"value": "1"
}
]
},
{
"dimensionValues": [
{
"value": "Organic Search"
},
{
"value": "date_range_0"
}
],
"metricValues": [
{
"value": "0.99953639313861842"
}
]
},
{
"dimensionValues": [
{
"value": "Direct"
},
{
"value": "date_range_0"
}
],
"metricValues": [
{
"value": "0.9981308411214953"
}
]
},
{
"dimensionValues": [
{
"value": "Direct"
},
{
"value": "date_range_1"
}
],
"metricValues": [
{
"value": "0.98655913978494625"
}
]
},
{
"dimensionValues": [
{
"value": "Unassigned"
},
{
"value": "date_range_0"
}
],
"metricValues": [
{
"value": "0.3625"
}
]
},
{
"dimensionValues": [
{
"value": "Unassigned"
},
{
"value": "date_range_1"
}
],
"metricValues": [
{
"value": "0.076923076923076927"
}
]
}
],
"totals": [
{
"dimensionValues": [
{
"value": "RESERVED_TOTAL"
},
{
"value": "date_range_0"
}
],
"metricValues": [
{
"value": "0.98451566438602811"
}
]
},
{
"dimensionValues": [
{
"value": "RESERVED_TOTAL"
},
{
"value": "date_range_1"
}
],
"metricValues": [
{
"value": "0.9842903575297941"
}
]
}
],
"maximums": [
{
"dimensionValues": [
{
"value": "RESERVED_MAX"
},
{
"value": "date_range_0"
}
],
"metricValues": [
{
"value": "1"
}
]
},
{
"dimensionValues": [
{
"value": "RESERVED_MAX"
},
{
"value": "date_range_1"
}
],
"metricValues": [
{
"value": "1"
}
]
}
],
"minimums": [
{
"dimensionValues": [
{
"value": "RESERVED_MIN"
},
{
"value": "date_range_0"
}
],
"metricValues": [
{
"value": "0.3625"
}
]
},
{
"dimensionValues": [
{
"value": "RESERVED_MIN"
},
{
"value": "date_range_1"
}
],
"metricValues": [
{
"value": "0.076923076923076927"
}
]
}
],
"rowCount": 6,
"metadata": {
"currencyCode": "USD",
"timeZone": "America/Los_Angeles"
},
"kind": "analyticsData#runReport"
}
Previous 90 days, limit 1Request: {
"dateRanges": [
{
"endDate": "2023-07-09",
"startDate": "2023-04-11"
},
{
"endDate": "2023-04-10",
"startDate": "2023-01-11"
}
],
"dimensions": [
{
"name": "sessionDefaultChannelGroup"
}
],
"keepEmptyRows": true,
"limit": 1,
"metricAggregations": [
"TOTAL",
"MINIMUM",
"MAXIMUM"
],
"metrics": [
{
"name": "sessionConversionRate"
}
],
"property": "properties/285794360"
} Response:{
"dimensionHeaders": [
{
"name": "sessionDefaultChannelGroup"
},
{
"name": "dateRange"
}
],
"metricHeaders": [
{
"name": "sessionConversionRate",
"type": "TYPE_FLOAT"
}
],
"rows": [
{
"dimensionValues": [
{
"value": "Direct"
},
{
"value": "date_range_0"
}
],
"metricValues": [
{
"value": "0.99552572706935127"
}
]
},
{
"dimensionValues": [
{
"value": "Direct"
},
{
"value": "date_range_1"
}
],
"metricValues": [
{
"value": "0.084192439862542962"
}
]
}
],
"totals": [
{
"dimensionValues": [
{
"value": "RESERVED_TOTAL"
},
{
"value": "date_range_0"
}
],
"metricValues": [
{
"value": "0.98747865680136593"
}
]
},
{
"dimensionValues": [
{
"value": "RESERVED_TOTAL"
},
{
"value": "date_range_1"
}
],
"metricValues": [
{
"value": "0.060317460317460318"
}
]
}
],
"maximums": [
{
"dimensionValues": [
{
"value": "RESERVED_MAX"
},
{
"value": "date_range_0"
}
],
"metricValues": [
{
"value": "1"
}
]
},
{
"dimensionValues": [
{
"value": "RESERVED_MAX"
},
{
"value": "date_range_1"
}
],
"metricValues": [
{
"value": "0.084192439862542962"
}
]
}
],
"minimums": [
{
"dimensionValues": [
{
"value": "RESERVED_MIN"
},
{
"value": "date_range_0"
}
],
"metricValues": [
{
"value": "0.27272727272727271"
}
]
},
{
"dimensionValues": [
{
"value": "RESERVED_MIN"
},
{
"value": "date_range_1"
}
],
"metricValues": [
{
"value": "0"
}
]
}
],
"rowCount": 6,
"metadata": {
"currencyCode": "USD",
"timeZone": "America/Los_Angeles"
},
"kind": "analyticsData#runReport"
} Previous 90 days, no limitIncluding this one for the sake of completion... Request: {
"dateRanges": [
{
"endDate": "2023-07-09",
"startDate": "2023-04-11"
},
{
"endDate": "2023-04-10",
"startDate": "2023-01-11"
}
],
"dimensions": [
{
"name": "sessionDefaultChannelGroup"
}
],
"keepEmptyRows": true,
"metricAggregations": [
"TOTAL",
"MINIMUM",
"MAXIMUM"
],
"metrics": [
{
"name": "sessionConversionRate"
}
],
"property": "properties/285794360"
} Response:{
"dimensionHeaders": [
{
"name": "sessionDefaultChannelGroup"
},
{
"name": "dateRange"
}
],
"metricHeaders": [
{
"name": "sessionConversionRate",
"type": "TYPE_FLOAT"
}
],
"rows": [
{
"dimensionValues": [
{
"value": "Organic Social"
},
{
"value": "date_range_0"
}
],
"metricValues": [
{
"value": "1"
}
]
},
{
"dimensionValues": [
{
"value": "Organic Video"
},
{
"value": "date_range_0"
}
],
"metricValues": [
{
"value": "1"
}
]
},
{
"dimensionValues": [
{
"value": "Referral"
},
{
"value": "date_range_0"
}
],
"metricValues": [
{
"value": "1"
}
]
},
{
"dimensionValues": [
{
"value": "Organic Search"
},
{
"value": "date_range_0"
}
],
"metricValues": [
{
"value": "0.99981634527089069"
}
]
},
{
"dimensionValues": [
{
"value": "Direct"
},
{
"value": "date_range_0"
}
],
"metricValues": [
{
"value": "0.99552572706935127"
}
]
},
{
"dimensionValues": [
{
"value": "Unassigned"
},
{
"value": "date_range_0"
}
],
"metricValues": [
{
"value": "0.27272727272727271"
}
]
},
{
"dimensionValues": [
{
"value": "Direct"
},
{
"value": "date_range_1"
}
],
"metricValues": [
{
"value": "0.084192439862542962"
}
]
},
{
"dimensionValues": [
{
"value": "Organic Search"
},
{
"value": "date_range_1"
}
],
"metricValues": [
{
"value": "0.056869471023650475"
}
]
},
{
"dimensionValues": [
{
"value": "Unassigned"
},
{
"value": "date_range_1"
}
],
"metricValues": [
{
"value": "0.0375"
}
]
},
{
"dimensionValues": [
{
"value": "Referral"
},
{
"value": "date_range_1"
}
],
"metricValues": [
{
"value": "0.010526315789473684"
}
]
},
{
"dimensionValues": [
{
"value": "Organic Social"
},
{
"value": "date_range_1"
}
],
"metricValues": [
{
"value": "0"
}
]
},
{
"dimensionValues": [
{
"value": "Organic Video"
},
{
"value": "date_range_1"
}
],
"metricValues": [
{
"value": "0"
}
]
}
],
"totals": [
{
"dimensionValues": [
{
"value": "RESERVED_TOTAL"
},
{
"value": "date_range_0"
}
],
"metricValues": [
{
"value": "0.98747865680136593"
}
]
},
{
"dimensionValues": [
{
"value": "RESERVED_TOTAL"
},
{
"value": "date_range_1"
}
],
"metricValues": [
{
"value": "0.060317460317460318"
}
]
}
],
"maximums": [
{
"dimensionValues": [
{
"value": "RESERVED_MAX"
},
{
"value": "date_range_0"
}
],
"metricValues": [
{
"value": "1"
}
]
},
{
"dimensionValues": [
{
"value": "RESERVED_MAX"
},
{
"value": "date_range_1"
}
],
"metricValues": [
{
"value": "0.084192439862542962"
}
]
}
],
"minimums": [
{
"dimensionValues": [
{
"value": "RESERVED_MIN"
},
{
"value": "date_range_0"
}
],
"metricValues": [
{
"value": "0.27272727272727271"
}
]
},
{
"dimensionValues": [
{
"value": "RESERVED_MIN"
},
{
"value": "date_range_1"
}
],
"metricValues": [
{
"value": "0"
}
]
}
],
"rowCount": 6,
"metadata": {
"currencyCode": "USD",
"timeZone": "America/Los_Angeles"
},
"kind": "analyticsData#runReport"
} |
Thanks @techanvil – I think this is good for now. We can follow-up with updates to the accuracy of the numbers if needed, but it doesn't need to block us here. |
Summary
Addresses issue:
Relevant technical choices
PR Author Checklist
Do not alter or remove anything below. The following sections will be managed by moderators only.
Code Reviewer Checklist
Merge Reviewer Checklist