Skip to content
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

Add support for querying Analytics reports with dimension filters #2421

Closed
felixarntz opened this issue Nov 24, 2020 · 4 comments
Closed

Add support for querying Analytics reports with dimension filters #2421

felixarntz opened this issue Nov 24, 2020 · 4 comments
Labels
Module: Analytics Google Analytics module related issues P0 High priority QA: Eng Requires specialized QA by an engineer Rollover Issues which role over to the next sprint Type: Enhancement Improvement of an existing feature
Milestone

Comments

@felixarntz
Copy link
Member

felixarntz commented Nov 24, 2020

Currently it is not possible to use dimension filters when requesting an Analytics report. This should be implemented as it is needed for the new Analytics All Traffic widget (see #2420).


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • The GET:report datapoint in the Analytics class should be expanded to support an optional dimensionFilters argument:
  • The getReport selector of the modules/analytics datastore should be enhanced accordingly, so that the new dimensionFilters argument is supported. The argument should also be documented as one of the selector's options.

Implementation Brief

  • Update the Google\Site_Kit\Modules\Analytics class:
    • Check if the $data['dimensionFilters'] isn't empty the handler for the GET:report endpoint and copy over its values into the appropriate dimensionFilters property of the $request_args variable. Please, make sure you to filter out dimensions that are not listed in the $request_args['dimensions'] array;
    • Update the create_analytics_site_data_request method to populate dimension filters if $args['dimensionFilters'] property isn't empty. See AC for additional details.
  • Update the report datastore in the assets/js/modules/analytics/datastore/report.js file:
    • Add dimensionFilters validator to the validateParams function of the fetchGetReportStore store. It should check whether dimensionFilters is a map of dimension names and values and all dimension names are also defined in the dimensions option.
    • Update jsdoc for the getReport selector to list dimensionFilters argument of the options paramter.

Test Coverage

  • Adjust existing tests if any are failing.

Visual Regression Changes

  • Not expected.

QA Brief

  • Check the handler for the GET:report endpoint in the Analytics class and make sure it processes dimension filters correctly.

Changelog entry

  • Add support for a dimensionFilters argument to the Analytics GET:report REST datapoint in PHP and the getReport selector in JS.
@felixarntz felixarntz added P0 High priority Type: Enhancement Improvement of an existing feature QA: Eng Requires specialized QA by an engineer Next Up Module: Analytics Google Analytics module related issues labels Nov 24, 2020
@felixarntz felixarntz assigned felixarntz and unassigned felixarntz Nov 24, 2020
@eclarke1 eclarke1 added this to the Sprint 38 milestone Nov 30, 2020
@felixarntz felixarntz self-assigned this Dec 3, 2020
@felixarntz
Copy link
Member Author

IB ✅

@aaemnnosttv
Copy link
Collaborator

@felixarntz CR ✅

@eclarke1 eclarke1 added the Rollover Issues which role over to the next sprint label Dec 21, 2020
@fhollis fhollis modified the milestones: Sprint 38, Sprint 39 Dec 21, 2020
@fhollis fhollis modified the milestones: Sprint 39, Sprint 40 Jan 4, 2021
@ivankruchkoff
Copy link
Contributor

Resolved MR issues, back to you @felixarntz.

@eugene-manuilov
Copy link
Collaborator

QA ✔️ All looks good. Dimension filters work as expected.

@eugene-manuilov eugene-manuilov removed their assignment Jan 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Module: Analytics Google Analytics module related issues P0 High priority QA: Eng Requires specialized QA by an engineer Rollover Issues which role over to the next sprint Type: Enhancement Improvement of an existing feature
Projects
None yet
Development

No branches or pull requests

6 participants