Google Analytics - Version 2.3.8

Version Description

  • Fix compatibility with WPML.
Download this release

Release Info

Developer ShareThis
Plugin Icon wp plugin Google Analytics
Version 2.3.8
Comparing to
See all releases

Code changes from version 2.3.7 to 2.3.8

class/Ga_Admin.php CHANGED
@@ -105,7 +105,7 @@ class Ga_Admin {
105
  */
106
  public static function update_googleanalytics() {
107
  $version = get_option( self::GA_VERSION_OPTION_NAME );
108
- $installed_version = get_option( self::GA_VERSION_OPTION_NAME, '2.3.7' );
109
  $old_property_value = Ga_Helper::get_option( 'web_property_id' );
110
 
111
  if ( version_compare( $installed_version, GOOGLEANALYTICS_VERSION, 'lt' ) ) {
105
  */
106
  public static function update_googleanalytics() {
107
  $version = get_option( self::GA_VERSION_OPTION_NAME );
108
+ $installed_version = get_option( self::GA_VERSION_OPTION_NAME, '2.3.8' );
109
  $old_property_value = Ga_Helper::get_option( 'web_property_id' );
110
 
111
  if ( version_compare( $installed_version, GOOGLEANALYTICS_VERSION, 'lt' ) ) {
class/Ga_Frontend.php CHANGED
@@ -1,48 +1,58 @@
1
- <?php
2
-
3
- class Ga_Frontend {
4
-
5
- const GA_SHARETHIS_PLATFORM_URL = '//platform-api.sharethis.com/js/sharethis.js';
6
-
7
- public static function platform_sharethis() {
8
- $url = self::GA_SHARETHIS_PLATFORM_URL . '#product=ga';
9
- if ( get_option( Ga_Admin::GA_SHARETHIS_PROPERTY_ID ) ) {
10
- $url = $url . '&property=' . get_option( Ga_Admin::GA_SHARETHIS_PROPERTY_ID );
11
- }
12
- wp_register_script( GA_NAME . '-platform-sharethis', $url, null, null, false );
13
- wp_enqueue_script( GA_NAME . '-platform-sharethis' );
14
- }
15
-
16
- /**
17
- * Adds frontend actions hooks.
18
- */
19
- public static function add_actions() {
20
- if ( Ga_Helper::are_features_enabled() ) {
21
- add_action( 'wp_enqueue_scripts', 'Ga_Frontend::platform_sharethis' );
22
- }
23
- add_action( 'wp_footer', 'Ga_Frontend::insert_ga_script' );
24
- }
25
-
26
- public static function insert_ga_script() {
27
- if ( Ga_Helper::can_add_ga_code() || Ga_Helper::is_all_feature_disabled() ) {
28
- Ga_View_Core::load( 'ga_googleanalytics_loader', array(
29
- 'ajaxurl' => add_query_arg( Ga_Controller_Core::ACTION_PARAM_NAME, 'googleanalytics_get_script', home_url() )
30
- ) );
31
- }
32
- }
33
-
34
- /**
35
- * Gets and returns Web Property Id.
36
- *
37
- * @return string Web Property Id
38
- */
39
- public static function get_web_property_id() {
40
- $web_property_id = get_option( Ga_Admin::GA_WEB_PROPERTY_ID_OPTION_NAME );
41
- if ( Ga_Helper::is_code_manually_enabled() || Ga_Helper::is_all_feature_disabled() ) {
42
- $web_property_id = get_option( Ga_Admin::GA_WEB_PROPERTY_ID_MANUALLY_VALUE_OPTION_NAME );
43
- }
44
-
45
- return $web_property_id;
46
- }
47
-
48
- }
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ga_Frontend {
4
+
5
+ const GA_SHARETHIS_PLATFORM_URL = '//platform-api.sharethis.com/js/sharethis.js';
6
+
7
+ public static function platform_sharethis() {
8
+ $url = self::GA_SHARETHIS_PLATFORM_URL . '#product=ga';
9
+ if ( get_option( Ga_Admin::GA_SHARETHIS_PROPERTY_ID ) ) {
10
+ $url = $url . '&property=' . get_option( Ga_Admin::GA_SHARETHIS_PROPERTY_ID );
11
+ }
12
+ wp_register_script( GA_NAME . '-platform-sharethis', $url, null, null, false );
13
+ wp_enqueue_script( GA_NAME . '-platform-sharethis' );
14
+ }
15
+
16
+ /**
17
+ * Adds frontend actions hooks.
18
+ */
19
+ public static function add_actions() {
20
+ if ( Ga_Helper::are_features_enabled() ) {
21
+ add_action( 'wp_enqueue_scripts', 'Ga_Frontend::platform_sharethis' );
22
+ }
23
+ add_action( 'wp_head', 'Ga_Frontend::insert_ga_script' );
24
+ }
25
+
26
+ public static function insert_ga_script() {
27
+ if ( Ga_Helper::can_add_ga_code() || Ga_Helper::is_all_feature_disabled() ) {
28
+ $web_property_id = Ga_Frontend::get_web_property_id();
29
+ $optimize = get_option( 'googleanalytics_optimize_code' );
30
+ $anonymization = get_option( 'googleanalytics_ip_anonymization' );
31
+
32
+ if ( Ga_Helper::should_load_ga_javascript( $web_property_id ) ) {
33
+ $data = array(
34
+ Ga_Admin::GA_WEB_PROPERTY_ID_OPTION_NAME => $web_property_id,
35
+ 'optimize' => $optimize,
36
+ 'anonymization' => $anonymization,
37
+ );
38
+
39
+ include plugin_dir_path( __FILE__ ) . '../view/ga_code.php';
40
+ }
41
+ }
42
+ }
43
+
44
+ /**
45
+ * Gets and returns Web Property Id.
46
+ *
47
+ * @return string Web Property Id
48
+ */
49
+ public static function get_web_property_id() {
50
+ $web_property_id = get_option( Ga_Admin::GA_WEB_PROPERTY_ID_OPTION_NAME );
51
+ if ( Ga_Helper::is_code_manually_enabled() || Ga_Helper::is_all_feature_disabled() ) {
52
+ $web_property_id = get_option( Ga_Admin::GA_WEB_PROPERTY_ID_MANUALLY_VALUE_OPTION_NAME );
53
+ }
54
+
55
+ return $web_property_id;
56
+ }
57
+
58
+ }
class/Ga_Helper.php CHANGED
@@ -35,9 +35,6 @@ class Ga_Helper {
35
 
36
  if ( ! is_admin() ) {
37
  Ga_Frontend::add_actions();
38
-
39
- $frontend_controller = new Ga_Frontend_Controller();
40
- $frontend_controller->handle_actions();
41
  }
42
 
43
  if ( is_admin() ) {
35
 
36
  if ( ! is_admin() ) {
37
  Ga_Frontend::add_actions();
 
 
 
38
  }
39
 
40
  if ( is_admin() ) {
class/controller/Ga_Frontend_Controller.php DELETED
@@ -1,34 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Created by PhpStorm.
5
- * User: mdn
6
- * Date: 2017-02-01
7
- * Time: 09:46
8
- */
9
- class Ga_Frontend_Controller extends Ga_Controller_Core {
10
-
11
- public static function googleanalytics_get_script() {
12
- if ( !empty( $_SERVER[ 'HTTP_X_REQUESTED_WITH' ] ) && strtolower( $_SERVER[ 'HTTP_X_REQUESTED_WITH' ] ) == 'xmlhttprequest' ) {
13
- $web_property_id = Ga_Frontend::get_web_property_id();
14
- $optimize = get_option( 'googleanalytics_optimize_code' );
15
- $anonymization = get_option( 'googleanalytics_ip_anonymization' );
16
-
17
- if ( Ga_Helper::should_load_ga_javascript( $web_property_id ) ) {
18
- $javascript = Ga_View_Core::load( 'ga_code', array(
19
- 'data' => array(
20
- Ga_Admin::GA_WEB_PROPERTY_ID_OPTION_NAME => $web_property_id,
21
- 'optimize' => $optimize,
22
- 'anonymization' => $anonymization,
23
- ),
24
- ),
25
- true );
26
- echo strip_tags( $javascript );
27
- }
28
- } else {
29
- wp_redirect( home_url() );
30
- }
31
- exit();
32
- }
33
-
34
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
googleanalytics.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Google Analytics
5
  * Plugin URI: http://wordpress.org/extend/plugins/googleanalytics/
6
  * Description: Use Google Analytics on your WordPress site without touching any code, and view visitor reports right in your WordPress admin dashboard!
7
- * Version: 2.3.7
8
  * Author: ShareThis
9
  * Author URI: http://sharethis.com
10
  */
@@ -47,7 +47,7 @@ if ( !preg_match( '/(\/|\\\)' . GA_NAME . '(\/|\\\)/', realpath( __FILE__ ), $te
47
  die();
48
  }
49
 
50
- define( 'GOOGLEANALYTICS_VERSION', '2.3.7' );
51
  include_once GA_PLUGIN_DIR . '/overwrite/ga_overwrite.php';
52
  include_once GA_PLUGIN_DIR . '/class/Ga_Autoloader.php';
53
  include_once GA_PLUGIN_DIR . '/tools/class-support-logging.php';
4
  * Plugin Name: Google Analytics
5
  * Plugin URI: http://wordpress.org/extend/plugins/googleanalytics/
6
  * Description: Use Google Analytics on your WordPress site without touching any code, and view visitor reports right in your WordPress admin dashboard!
7
+ * Version: 2.3.8
8
  * Author: ShareThis
9
  * Author URI: http://sharethis.com
10
  */
47
  die();
48
  }
49
 
50
+ define( 'GOOGLEANALYTICS_VERSION', '2.3.8' );
51
  include_once GA_PLUGIN_DIR . '/overwrite/ga_overwrite.php';
52
  include_once GA_PLUGIN_DIR . '/class/Ga_Autoloader.php';
53
  include_once GA_PLUGIN_DIR . '/tools/class-support-logging.php';
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: sharethis, scottstorebloom
3
  Tags: analytics, google analytics, google analytics plugin, google analytics widget, google analytics dashboard
4
  Requires at least: 3.8
5
- Tested up to: 5.4.1
6
- Stable tag: 2.3.7
7
 
8
  Use Google Analytics on your Wordpress site without touching any code, and view visitor reports right in your Wordpress admin dashboard!
9
 
@@ -56,6 +56,9 @@ By downloading and installing this plugin, you are agreeing to the [Privacy Poli
56
  5. When any of your content takes off you will see the URLs inside the Trending Content section
57
 
58
  == Frequently Asked Questions ==
 
 
 
59
  = Why do I need an SSL certificate to use this plugin? =
60
  Since the plugin accesses your Google Analytics account your login information is transerfered from our plugin to google. This needs to be secure so SSL is required to keep your information safe.
61
 
@@ -84,6 +87,9 @@ We are always happy to help.
84
 
85
  == Changelog ==
86
 
 
 
 
87
  = 2.3.7 =
88
  * Fix property creation structure.
89
  * Remove terms blocker.
2
  Contributors: sharethis, scottstorebloom
3
  Tags: analytics, google analytics, google analytics plugin, google analytics widget, google analytics dashboard
4
  Requires at least: 3.8
5
+ Tested up to: 5.4.2
6
+ Stable tag: 2.3.8
7
 
8
  Use Google Analytics on your Wordpress site without touching any code, and view visitor reports right in your Wordpress admin dashboard!
9
 
56
  5. When any of your content takes off you will see the URLs inside the Trending Content section
57
 
58
  == Frequently Asked Questions ==
59
+ = Is this plugin compatible with WPML? =
60
+ Yes! We've made adjustments to allow for WPML pages to be tracked properly.
61
+
62
  = Why do I need an SSL certificate to use this plugin? =
63
  Since the plugin accesses your Google Analytics account your login information is transerfered from our plugin to google. This needs to be secure so SSL is required to keep your information safe.
64
 
87
 
88
  == Changelog ==
89
 
90
+ = 2.3.8 =
91
+ * Fix compatibility with WPML.
92
+
93
  = 2.3.7 =
94
  * Fix property creation structure.
95
  * Remove terms blocker.