Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Modify the google analytics request params in the google top content plugin
<?php
/**
* Change metric from 'ga:pageViews' for top-content widget and shortcode
*
* @link https://ga-dev-tools.appspot.com/query-explorer/ Google's Query Explorer for more info
*
* @param array $params Array of request params
*
* @return array Modified array of request params
*/
function gtc_modify_request_metric( $params ) {
$params['metrics'] = 'ga:uniquePageviews';
return $params;
}
add_filter( 'gtc_analytics_top_content_shortcode_request_params', 'gtc_modify_request_metric' );
add_filter( 'gtc_analytics_top_content_widget_request_params', 'gtc_modify_request_metric' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.