Skip to content

Commit

Permalink
Update dimension filters across different places.
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitrox committed Feb 10, 2025
1 parent 7db2b5c commit ddf7942
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,9 @@ function getReportOptions( select ) {
dimensionFilters: {
// Make sure that we select only rows without (not set) records.
'customEvent:googlesitekit_post_categories': {
filterType: 'stringFilter',
matchType: 'EXACT',
value: '(not set)',
notExpression: true,
filterType: 'emptyFilter',
value: '',
notExpression: false,
},
},
metrics: [ { name: 'screenPageViews' } ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,9 @@ function TopCitiesDrivingAddToCartWidget( { Widget } ) {
dimensions: [ 'city' ],
dimensionFilters: {
city: {
filterType: 'stringFilter',
matchType: 'EXACT',
value: '(not set)',
notExpression: true,
filterType: 'emptyFilter',
value: '',
notExpression: false,
},
},
metrics: [ { name: 'addToCarts' } ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,9 @@ function TopCitiesDrivingLeadsWidget( { Widget } ) {
value: eventNames,
},
city: {
filterType: 'stringFilter',
matchType: 'EXACT',
value: '(not set)',
notExpression: true,
filterType: 'emptyFilter',
value: '',
notExpression: false,
},
},
metrics: [ { name: 'eventCount' } ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,9 @@ function TopCitiesDrivingPurchasesWidget( { Widget } ) {
dimensions: [ 'city' ],
dimensionFilters: {
city: {
filterType: 'stringFilter',
matchType: 'EXACT',
value: '(not set)',
notExpression: true,
filterType: 'emptyFilter',
value: '',
notExpression: false,
},
},
metrics: [ { name: 'ecommercePurchases' } ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,7 @@ const baseActions = {
MODULES_ANALYTICS_4
).getErrorForSelector( 'getReport', [ reportArgs ] );

const isGatheringData =
hasReportError ||
! report?.rows?.length ||
// If the only dimension value is '(not set)', then there is no data. See https://support.google.com/analytics/answer/13504892.
( report.rowCount === 1 &&
report.rows[ 0 ].dimensionValues?.[ 0 ]?.value ===
'(not set)' );
const isGatheringData = hasReportError || ! report?.rows?.length;

yield baseActions.receiveIsCustomDimensionGatheringData(
customDimension,
Expand Down Expand Up @@ -331,8 +325,15 @@ const baseSelectors = {
startDate: getDateString( new Date( propertyCreateTime ) ),
endDate,
dimensions: [ `customEvent:${ customDimension }` ],
dimensionFilters: {
[ `customEvent:${ customDimension }` ]: {
filterType: 'emptyFilter',
value: '',
notExpression: false,
},
},
metrics: [ { name: 'eventCount' } ],
limit: 2,
limit: 1,
};
}
),
Expand Down

0 comments on commit ddf7942

Please sign in to comment.