Created
May 15, 2015 13:45
-
-
Save jtsternberg/918238ff899c2762b41b to your computer and use it in GitHub Desktop.
Modify the google analytics request params in the google top content plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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