Google Analytics for WordPress by MonsterInsights - Version 4.3.3

Version Description

  • Fix a possible fatal error in tracking.
Download this release

Release Info

Developer joostdevalk
Plugin Icon 128x128 Google Analytics for WordPress by MonsterInsights
Version 4.3.3
Comparing to
See all releases

Code changes from version 4.3.2 to 4.3.3

admin/class-admin.php CHANGED
@@ -286,18 +286,16 @@ class GA_Admin extends Yoast_GA_Plugin_Admin {
286
  }
287
 
288
  $args = array(
289
- 'scope' => 'https://www.google.com/analytics/feeds/',
290
  'xoauth_displayname' => 'Google Analytics for WordPress by Yoast'
291
  );
292
  $access_token = $options['gawp_oauth']['access_token'];
293
  $gdata = new WP_Gdata( $args, $access_token['oauth_token'], $access_token['oauth_token_secret'] );
294
 
295
-
296
  $response = $gdata->get( 'https://www.googleapis.com/analytics/v2.4/management/accounts/~all/webproperties/~all/profiles' );
297
  $http_code = wp_remote_retrieve_response_code( $response );
298
  $response = wp_remote_retrieve_body( $response );
299
 
300
-
301
  if ( $http_code == 200 ) {
302
  $options['ga_api_responses'][$token] = array(
303
  'response' => array( 'code' => $http_code ),
286
  }
287
 
288
  $args = array(
289
+ 'scope' => 'https://www.googleapis.com/auth/analytics.readonly',
290
  'xoauth_displayname' => 'Google Analytics for WordPress by Yoast'
291
  );
292
  $access_token = $options['gawp_oauth']['access_token'];
293
  $gdata = new WP_Gdata( $args, $access_token['oauth_token'], $access_token['oauth_token_secret'] );
294
 
 
295
  $response = $gdata->get( 'https://www.googleapis.com/analytics/v2.4/management/accounts/~all/webproperties/~all/profiles' );
296
  $http_code = wp_remote_retrieve_response_code( $response );
297
  $response = wp_remote_retrieve_body( $response );
298
 
 
299
  if ( $http_code == 200 ) {
300
  $options['ga_api_responses'][$token] = array(
301
  'response' => array( 'code' => $http_code ),
googleanalytics.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Google Analytics for WordPress
4
  Plugin URI: http://yoast.com/wordpress/google-analytics/#utm_source=wordpress&utm_medium=plugin&utm_campaign=wpgaplugin&utm_content=v420
5
  Description: This plugin makes it simple to add Google Analytics to your WordPress blog, adding lots of features, eg. custom variables and automatic clickout and download tracking.
6
  Author: Joost de Valk
7
- Version: 4.3.2
8
  Requires at least: 3.0
9
  Author URI: http://yoast.com/
10
  License: GPL v3
@@ -28,7 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
28
 
29
  // This plugin was originally based on Rich Boakes' Analytics plugin: http://boakes.org/analytics, but has since been rewritten and refactored multiple times.
30
 
31
- define( "GAWP_VERSION", '4.3.2' );
32
 
33
  define( "GAWP_URL", trailingslashit( plugin_dir_url( __FILE__ ) ) );
34
 
4
  Plugin URI: http://yoast.com/wordpress/google-analytics/#utm_source=wordpress&utm_medium=plugin&utm_campaign=wpgaplugin&utm_content=v420
5
  Description: This plugin makes it simple to add Google Analytics to your WordPress blog, adding lots of features, eg. custom variables and automatic clickout and download tracking.
6
  Author: Joost de Valk
7
+ Version: 4.3.3
8
  Requires at least: 3.0
9
  Author URI: http://yoast.com/
10
  License: GPL v3
28
 
29
  // This plugin was originally based on Rich Boakes' Analytics plugin: http://boakes.org/analytics, but has since been rewritten and refactored multiple times.
30
 
31
+ define( "GAWP_VERSION", '4.3.3' );
32
 
33
  define( "GAWP_URL", trailingslashit( plugin_dir_url( __FILE__ ) ) );
34
 
images/ga-icon-32x32.png ADDED
Binary file
inc/class-tracking.php CHANGED
@@ -9,7 +9,11 @@ if ( !defined( 'GAWP_VERSION' ) ) {
9
  }
10
 
11
  /**
12
- * Class that creates the tracking functionality for Yoast Plugins, as the core class might be used in more plugins, it's checked for existence first.
 
 
 
 
13
  */
14
  if ( !class_exists( 'Yoast_Tracking' ) ) {
15
  class Yoast_Tracking {
@@ -31,7 +35,7 @@ if ( !class_exists( 'Yoast_Tracking' ) ) {
31
  */
32
  function tracking() {
33
  // Start of Metrics
34
- global $wpdb;
35
 
36
  $hash = get_option( 'Yoast_Tracking_Hash' );
37
 
@@ -61,8 +65,7 @@ if ( !class_exists( 'Yoast_Tracking' ) ) {
61
  'author' => $theme_data->display( 'Author', false, false ),
62
  'author_uri' => $theme_data->display( 'AuthorURI', false, false ),
63
  );
64
- $parent_theme = $theme_data->__get('parent_theme');
65
- if ( isset( $parent_theme ) && !empty( $parent_theme ) && $theme_data->parent() ) {
66
  $theme['template'] = array(
67
  'version' => $theme_data->parent()->display( 'Version', false, false ),
68
  'name' => $theme_data->parent()->display( 'Name', false, false ),
@@ -85,6 +88,9 @@ if ( !class_exists( 'Yoast_Tracking' ) ) {
85
 
86
  $plugins = array();
87
  foreach ( get_option( 'active_plugins' ) as $plugin_path ) {
 
 
 
88
  $plugin_info = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin_path );
89
 
90
  $slug = str_replace( '/' . basename( $plugin_path ), '', $plugin_path );
@@ -100,11 +106,9 @@ if ( !class_exists( 'Yoast_Tracking' ) ) {
100
  $data = array(
101
  'site' => array(
102
  'hash' => $hash,
103
- 'url' => site_url(),
104
- 'name' => get_bloginfo( 'name' ),
105
  'version' => get_bloginfo( 'version' ),
106
  'multisite' => is_multisite(),
107
- 'users' => count( get_users() ),
108
  'lang' => get_locale(),
109
  ),
110
  'pts' => $pts,
9
  }
10
 
11
  /**
12
+ * Class that creates the tracking functionality for WP SEO, as the core class might be used in more plugins,
13
+ * it's checked for existence first.
14
+ *
15
+ * NOTE: this functionality is opt-in. Disabling the tracking in the settings or saying no when asked will cause
16
+ * this file to not even be loaded.
17
  */
18
  if ( !class_exists( 'Yoast_Tracking' ) ) {
19
  class Yoast_Tracking {
35
  */
36
  function tracking() {
37
  // Start of Metrics
38
+ global $blog_id, $wpdb;
39
 
40
  $hash = get_option( 'Yoast_Tracking_Hash' );
41
 
65
  'author' => $theme_data->display( 'Author', false, false ),
66
  'author_uri' => $theme_data->display( 'AuthorURI', false, false ),
67
  );
68
+ if ( isset( $theme_data->template ) && !empty( $theme_data->template ) && $theme_data->parent() ) {
 
69
  $theme['template'] = array(
70
  'version' => $theme_data->parent()->display( 'Version', false, false ),
71
  'name' => $theme_data->parent()->display( 'Name', false, false ),
88
 
89
  $plugins = array();
90
  foreach ( get_option( 'active_plugins' ) as $plugin_path ) {
91
+ if ( !function_exists( 'get_plugin_data' ) )
92
+ require_once ABSPATH . 'wp-admin/includes/admin.php';
93
+
94
  $plugin_info = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin_path );
95
 
96
  $slug = str_replace( '/' . basename( $plugin_path ), '', $plugin_path );
106
  $data = array(
107
  'site' => array(
108
  'hash' => $hash,
 
 
109
  'version' => get_bloginfo( 'version' ),
110
  'multisite' => is_multisite(),
111
+ 'users' => $wpdb->get_var( "SELECT COUNT(*) FROM wp_users INNER JOIN wp_usermeta ON (wp_users.ID = wp_usermeta.user_id) WHERE 1 = 1 AND ( wp_usermeta.meta_key = 'wp_{$blog_id}_capabilities' ) " ),
112
  'lang' => get_locale(),
113
  ),
114
  'pts' => $pts,
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://yoast.com/donate/
4
  Tags: analytics, google analytics, statistics, tracking, stats, google
5
  Requires at least: 3.3
6
  Tested up to: 3.5
7
- Stable tag: 4.3.2
8
 
9
  Track your WordPress site easily and with lots of metadata: views per author & category, automatic tracking of outbound clicks and pageviews.
10
 
@@ -58,10 +58,14 @@ This section describes how to install the plugin and get it working.
58
 
59
  == Changelog ==
60
 
 
 
 
 
61
  = 4.3.2 =
62
 
63
  * Bugfix: Google Analytics crappy API output is different when you have a single GA account versus multiple. Annoying, but fixed now.
64
-
65
  = 4.3.1 =
66
 
67
  * Removes a left over JS alert.
4
  Tags: analytics, google analytics, statistics, tracking, stats, google
5
  Requires at least: 3.3
6
  Tested up to: 3.5
7
+ Stable tag: 4.3.3
8
 
9
  Track your WordPress site easily and with lots of metadata: views per author & category, automatic tracking of outbound clicks and pageviews.
10
 
58
 
59
  == Changelog ==
60
 
61
+ = 4.3.3 =
62
+
63
+ * Fix a possible fatal error in tracking.
64
+
65
  = 4.3.2 =
66
 
67
  * Bugfix: Google Analytics crappy API output is different when you have a single GA account versus multiple. Annoying, but fixed now.
68
+
69
  = 4.3.1 =
70
 
71
  * Removes a left over JS alert.