Skip to content

Commit

Permalink
Update currentTotalSessions const to make use of rows as opposed to t…
Browse files Browse the repository at this point in the history
…otals property of GA4 report object.
  • Loading branch information
10upsimon committed Oct 5, 2023
1 parent 2775924 commit 8e743aa
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function VisitsPerVisitorWidget( { Widget } ) {
)
);

const { rows = [], totals = [] } = report || {};
const { rows = [] } = report || {};

const makeFind = ( dateRange ) => ( row ) =>
get( row, 'dimensionValues.0.value' ) === dateRange;
Expand All @@ -88,7 +88,9 @@ function VisitsPerVisitorWidget( { Widget } ) {
0;

const currentTotalSessions =
Number( totals[ 0 ]?.metricValues?.[ 1 ]?.value ) || 0;
Number(
rows.find( makeFind( 'date_range_0' ) )?.metricValues?.[ 1 ]?.value
) || 0;

return (
<MetricTileNumeric
Expand Down

0 comments on commit 8e743aa

Please sign in to comment.