Support » Plugin: Site Kit by Google - Analytics, Search Console, AdSense, Speed » Dimension filters parameter does not support all supported match types

  • Resolved John

    (@thesun2012)


    Hello,

    I have been developing a plugin to retrieve Google Analytics Reports for the front-end page using Google Sitekit Rest API, everything is working fine but I realized that the Dimension filters parameter does not support all supported match types https://developers.google.com/analytics/devguides/reporting/core/v4/rest/v4/reports/batchGet?hl=vi#Operator

    In google-site-kit/includes/Modules/Analytics.php file at lines 545 and 548

    This may retrieve wrong page views reports, could you add other operators such as PARTIAL, REGEXP, BEGINS_WITH, ENDS_WITH … in the next update?

    $dimension_filters          = $data['dimensionFilters'];
    				$dimension_filter_instances = array();
    				if ( ! empty( $dimension_filters ) && is_array( $dimension_filters ) ) {
    					foreach ( $dimension_filters as $dimension_name => $dimension_value ) {
    						$dimension_filter = new Google_Service_AnalyticsReporting_DimensionFilter();
    						$dimension_filter->setDimensionName( $dimension_name );
    						if ( is_array( $dimension_value ) ) {
    							$dimension_filter->setOperator( 'IN_LIST' );
    							$dimension_filter->setExpressions( $dimension_value );
    						} else {
    							$dimension_filter->setOperator( 'EXACT' );
    							$dimension_filter->setExpressions( array( $dimension_value ) );
    						}
    						$dimension_filter_instances[] = $dimension_filter;
    					}
    
    					if ( ! empty( $dimension_filter_instances ) ) {
    						$request_args['dimension_filters'] = $dimension_filter_instances;
    					}
    				}
    • This topic was modified 1 year ago by John.
    • This topic was modified 1 year ago by John.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support James Osborne

    (@jamesosborne)

    Hi @thesun2012,

    Thanks for reaching out and proposing this change. Please allow me some time which I to check this with the team. In the meantime if you wish to propose any any changes to the plugin on the Site Kit GitHub repository if you wish. Regardless I’ll check this for you and open a GitHub issue on behalf of this request if necessary.

    Thread Starter John

    (@thesun2012)

    Thank you @jamesosborne, adding more match types would be a great update for the next version.

    Plugin Support James Osborne

    (@jamesosborne)

    Hi @thesun2012,

    Many thanks for your patience on this. I’ve created the following GitHub issue after discussing your request with the team.
    https://github.com/google/site-kit-wp/issues/4685

    Feel free to add any comments to that issue, or subscribe for further updates. As we’ve migrated this to a GitHub feature request I’ll close this support topic. Many thanks for the suggestion, and be sure to reach out if you have any further queries or suggestions!

    Thread Starter John

    (@thesun2012)

    Thank you, can’t wait for the next update.

    Cheers.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Dimension filters parameter does not support all supported match types’ is closed to new replies.