Google Analytics Dashboard for WP (GADWP) - Version 5.0.1

Version Description

  • Enhancements:
    • use site_url() to find the main domain name
    • display the page load time in seconds with two decimals
    • add custom categories, custom actions, and custom labels support for events tracking using data-ga-* attributes; props by Timo Schneider
    • display the update notice only on automatic updates
  • Bug Fixes:
    • prevent the default action of the click event to be triggered if the anchor click event was already prevented by other scripts
Download this release

Release Info

Developer deconf
Plugin Icon 128x128 Google Analytics Dashboard for WP (GADWP)
Version 5.0.1
Comparing to
See all releases

Code changes from version 5.0.0.1 to 5.0.1

config.php CHANGED
@@ -47,7 +47,10 @@ if ( ! class_exists( 'GADWP_Config' ) ) {
47
}
48
if ( isset( $item['slug'] ) && 'google-analytics-dashboard-for-wp' == $item['slug'] ) {
49
// Only when a minor update is available
50
- return ( $this->get_major_version( GADWP_CURRENT_VERSION ) == $this->get_major_version( $item['new_version'] ) );
51
}
52
return $update;
53
}
@@ -212,7 +215,6 @@ if ( ! class_exists( 'GADWP_Config' ) ) {
212
if ( GADWP_CURRENT_VERSION != get_option( 'gadwp_version' ) ) {
213
$flag = true;
214
update_option( 'gadwp_version', GADWP_CURRENT_VERSION );
215
- update_option( 'gadwp_got_updated', true );
216
$rebuild_token = json_decode( $this->options['ga_dash_token'] ); // v4.8.2
217
if ( is_object( $rebuild_token ) && ! isset( $rebuild_token->token_type ) ) {
218
if ( isset( $this->options['ga_dash_refresh_token'] ) ) {
47
}
48
if ( isset( $item['slug'] ) && 'google-analytics-dashboard-for-wp' == $item['slug'] ) {
49
// Only when a minor update is available
50
+ if ($this->get_major_version( GADWP_CURRENT_VERSION ) == $this->get_major_version( $item['new_version'] )){
51
+ update_option( 'gadwp_got_updated', true );
52
+ return ( $this->get_major_version( GADWP_CURRENT_VERSION ) == $this->get_major_version( $item['new_version'] ) );
53
+ }
54
}
55
return $update;
56
}
215
if ( GADWP_CURRENT_VERSION != get_option( 'gadwp_version' ) ) {
216
$flag = true;
217
update_option( 'gadwp_version', GADWP_CURRENT_VERSION );
218
$rebuild_token = json_decode( $this->options['ga_dash_token'] ); // v4.8.2
219
if ( is_object( $rebuild_token ) && ! isset( $rebuild_token->token_type ) ) {
220
if ( isset( $this->options['ga_dash_refresh_token'] ) ) {
front/js/tracking-analytics-events.js CHANGED
@@ -1 +1 @@
1
- var gadwpRedirectLink;var gadwpRedirectCalled=false;function gadwpRedirect(){if(gadwpRedirectCalled){return}gadwpRedirectCalled=true;document.location.href=gadwpRedirectLink}(function(a){a(window).load(function(){if(gadwpUAEventsData.options.event_tracking){a("a").filter(function(){var b=new RegExp(".*\\.("+gadwpUAEventsData.options.event_downloads+")(\\?.*)?quot;);return this.href.match(b)}).click(function(b){if(gadwpUAEventsData.options.event_bouncerate){ga("send","event","download","click",this.href,{nonInteraction:1})}else{ga("send","event","download","click",this.href)}});a('a[href^="mailto"]').click(function(b){if(gadwpUAEventsData.options.event_bouncerate){ga("send","event","email","send",this.href,{nonInteraction:1})}else{ga("send","event","email","send",this.href)}});a('a[href^="tel"]').click(function(b){if(gadwpUAEventsData.options.event_bouncerate){ga("send","event","telephone","call",this.href,{nonInteraction:1})}else{ga("send","event","telephone","call",this.href)}});if(gadwpUAEventsData.options.root_domain){a('a[href^="http"]').filter(function(){var b=new RegExp(".*\\.("+gadwpUAEventsData.options.event_downloads+")(\\?.*)?quot;);if(!this.href.match(b)){if(this.href.indexOf(gadwpUAEventsData.options.root_domain)==-1){return this.href}}}).click(function(b){gadwpRedirectCalled=false;gadwpRedirectLink=this.href;if(gadwpUAEventsData.options.event_bouncerate){ga("send","event","outbound","click",this.href,{nonInteraction:1,hitCallback:gadwpRedirect})}else{ga("send","event","outbound","click",this.href,{hitCallback:gadwpRedirect})}if(this.target!="_blank"){setTimeout(gadwpRedirect,gadwpUAEventsData.options.event_timeout);return false}else{gadwpRedirectCalled=true}})}}if(gadwpUAEventsData.options.event_affiliates&&gadwpUAEventsData.options.aff_tracking){a("a").filter(function(){if(gadwpUAEventsData.options.event_affiliates!=""){var b=new RegExp("("+gadwpUAEventsData.options.event_affiliates.replace(/\//g,"/")+")");return this.href.match(b)}}).click(function(b){gadwpRedirectCalled=false;gadwpRedirectLink=this.href;if(gadwpUAEventsData.options.event_bouncerate){ga("send","event","affiliates","click",this.href,{nonInteraction:1,hitCallback:gadwpRedirect})}else{ga("send","event","affiliates","click",this.href,{hitCallback:gadwpRedirect})}if(this.target!="_blank"){setTimeout(gadwpRedirect,gadwpUAEventsData.options.event_timeout);return false}else{gadwpRedirectCalled=true}})}if(gadwpUAEventsData.options.root_domain&&gadwpUAEventsData.options.hash_tracking){a("a").filter(function(){if(this.href.indexOf(gadwpUAEventsData.options.root_domain)!=-1||this.href.indexOf("://")==-1){return this.hash}}).click(function(b){if(gadwpUAEventsData.options.event_bouncerate){ga("send","event","hashmark","click",this.href,{nonInteraction:1})}else{ga("send","event","hashmark","click",this.href)}})}if(gadwpUAEventsData.options.event_formsubmit){a('input[type="submit"]').click(function(c){gadwpSubmitObject=this;var b=gadwpSubmitObject.value;if(gadwpUAEventsData.options.event_formsubmit){ga("send","event","form","submit",b,{nonInteraction:1})}else{ga("send","event","form","submit",b)}})}if(gadwpUAEventsData.options.ga_pagescrolldepth_tracking){a.scrollDepth({percentage:true,userTiming:false,pixelDepth:false,gtmOverride:true,nonInteraction:gadwpUAEventsData.options.event_bouncerate})}})})(jQuery);
1
+ "use strict";var gadwpRedirectLink;var gadwpRedirectCalled=false;var gadwpDefaultPrevented=false;function gadwpRedirect(){if(gadwpRedirectCalled){return}gadwpRedirectCalled=true;if(!gadwpDefaultPrevented){document.location.href=gadwpRedirectLink}else{gadwpDefaultPrevented=false}}(function(a){a(window).on("load",function(){if(gadwpUAEventsData.options.event_tracking){a("a").filter(function(){var b=new RegExp(".*\\.("+gadwpUAEventsData.options.event_downloads+")(\\?.*)?quot;);return this.href.match(b)}).click(function(f){var c=this.getAttribute("data-ga-category")||"download";var d=this.getAttribute("data-ga-action")||"click";var b=this.getAttribute("data-ga-label")||this.href;if(gadwpUAEventsData.options.event_bouncerate){ga("send","event",c,d,b,{nonInteraction:1})}else{ga("send","event",c,d,b)}});a('a[href^="mailto"]').click(function(f){var c=this.getAttribute("data-ga-category")||"email";var d=this.getAttribute("data-ga-action")||"send";var b=this.getAttribute("data-ga-label")||this.href;if(gadwpUAEventsData.options.event_bouncerate){ga("send","event",c,d,b,{nonInteraction:1})}else{ga("send","event",c,d,b)}});a('a[href^="tel"]').click(function(f){if(gadwpUAEventsData.options.event_bouncerate){var c=this.getAttribute("data-ga-category")||"telephone";var d=this.getAttribute("data-ga-action")||"call";var b=this.getAttribute("data-ga-label")||this.href;ga("send","event",c,d,b,{nonInteraction:1})}else{ga("send","event",c,d,b)}});if(gadwpUAEventsData.options.root_domain){a('a[href^="http"]').filter(function(){var b=new RegExp(".*\\.("+gadwpUAEventsData.options.event_downloads+")(\\?.*)?quot;);if(!this.href.match(b)){if(this.href.indexOf(gadwpUAEventsData.options.root_domain)==-1){return this.href}}}).click(function(f){gadwpRedirectCalled=false;gadwpRedirectLink=this.href;var c=this.getAttribute("data-ga-category")||"outbound";var d=this.getAttribute("data-ga-action")||"click";var b=this.getAttribute("data-ga-label")||this.href;if(gadwpUAEventsData.options.event_bouncerate){ga("send","event",c,d,b,{nonInteraction:1,hitCallback:gadwpRedirect})}else{ga("send","event",c,d,b,{hitCallback:gadwpRedirect})}if(this.target!="_blank"){if(f.isDefaultPrevented()){gadwpDefaultPrevented=true}setTimeout(gadwpRedirect,gadwpUAEventsData.options.event_timeout);return false}else{gadwpRedirectCalled=true}})}}if(gadwpUAEventsData.options.event_affiliates&&gadwpUAEventsData.options.aff_tracking){a("a").filter(function(){if(gadwpUAEventsData.options.event_affiliates!=""){var b=new RegExp("("+gadwpUAEventsData.options.event_affiliates.replace(/\//g,"/")+")");return this.href.match(b)}}).click(function(d){gadwpRedirectCalled=false;gadwpRedirectLink=this.href;var c=this.getAttribute("data-ga-category")||"affiliates";var f=this.getAttribute("data-ga-action")||"click";var b=this.getAttribute("data-ga-label")||this.href;if(gadwpUAEventsData.options.event_bouncerate){ga("send","event",c,f,b,{nonInteraction:1,hitCallback:gadwpRedirect})}else{ga("send","event",c,f,b,{hitCallback:gadwpRedirect})}if(this.target!="_blank"){if(e.isDefaultPrevented()){gadwpDefaultPrevented=true}setTimeout(gadwpRedirect,gadwpUAEventsData.options.event_timeout);return false}else{gadwpRedirectCalled=true}})}if(gadwpUAEventsData.options.root_domain&&gadwpUAEventsData.options.hash_tracking){a("a").filter(function(){if(this.href.indexOf(gadwpUAEventsData.options.root_domain)!=-1||this.href.indexOf("://")==-1){return this.hash}}).click(function(f){var c=this.getAttribute("data-ga-category")||"hashmark";var d=this.getAttribute("data-ga-action")||"click";var b=this.getAttribute("data-ga-label")||this.href;if(gadwpUAEventsData.options.event_bouncerate){ga("send","event",c,d,b,{nonInteraction:1})}else{ga("send","event",c,d,b)}})}if(gadwpUAEventsData.options.event_formsubmit){a('input[type="submit"]').click(function(f){gadwpSubmitObject=this;var c=gadwpSubmitObject.getAttribute("data-ga-category")||"form";var d=gadwpSubmitObject.getAttribute("data-ga-action")||"submit";var b=gadwpSubmitObject.getAttribute("data-ga-label")||gadwpSubmitObject.name||gadwpSubmitObject.value;if(gadwpUAEventsData.options.event_formsubmit){ga("send","event",c,d,b,{nonInteraction:1})}else{ga("send","event","form","submit",b)}})}if(gadwpUAEventsData.options.ga_pagescrolldepth_tracking){a.scrollDepth({percentage:true,userTiming:false,pixelDepth:false,gtmOverride:true,nonInteraction:gadwpUAEventsData.options.event_bouncerate})}})})(jQuery);
front/js/tracking-tagmanager-events.js CHANGED
@@ -1 +1 @@
1
- (function(a){a(window).load(function(){a.scrollDepth({percentage:true,userTiming:false,pixelDepth:false,gtmOverride:false})})})(jQuery);
1
+ (function(a){a(window).on("load",function(){a.scrollDepth({percentage:true,userTiming:false,pixelDepth:false,gtmOverride:false})})})(jQuery);
front/tracking-analytics.php CHANGED
@@ -78,8 +78,7 @@ if ( ! class_exists( 'GADWP_Tracking_Analytics' ) ) {
78
private function load_scripts() {
79
if ( $this->gadwp->config->options['ga_event_tracking'] || $this->gadwp->config->options['ga_aff_tracking'] || $this->gadwp->config->options['ga_hash_tracking'] || $this->gadwp->config->options['ga_pagescrolldepth_tracking'] ) {
80
81
- $domaindata = GADWP_Tools::get_root_domain( esc_html( get_option( 'siteurl' ) ) );
82
- $root_domain = $domaindata['domain'];
83
84
wp_enqueue_script( 'gadwp-tracking-analytics-events', GADWP_URL . 'front/js/tracking-analytics-events.js', array( 'jquery' ), GADWP_CURRENT_VERSION, $this->gadwp->config->options['trackingevents_infooter'] );
85
78
private function load_scripts() {
79
if ( $this->gadwp->config->options['ga_event_tracking'] || $this->gadwp->config->options['ga_aff_tracking'] || $this->gadwp->config->options['ga_hash_tracking'] || $this->gadwp->config->options['ga_pagescrolldepth_tracking'] ) {
80
81
+ $root_domain = GADWP_Tools::get_root_domain();
82
83
wp_enqueue_script( 'gadwp-tracking-analytics-events', GADWP_URL . 'front/js/tracking-analytics-events.js', array( 'jquery' ), GADWP_CURRENT_VERSION, $this->gadwp->config->options['trackingevents_infooter'] );
84
gadwp.php CHANGED
@@ -4,7 +4,7 @@
4
* Plugin URI: https://deconf.com
5
* Description: Displays Google Analytics Reports and Real-Time Statistics in your Dashboard. Automatically inserts the tracking code in every page of your website.
6
* Author: Alin Marcu
7
- * Version: 5.0.0.1
8
* Author URI: https://deconf.com
9
* Text Domain: google-analytics-dashboard-for-wp
10
* Domain Path: /languages
@@ -16,7 +16,7 @@ if ( ! defined( 'ABSPATH' ) )
16
17
// Plugin Version
18
if ( ! defined( 'GADWP_CURRENT_VERSION' ) ) {
19
- define( 'GADWP_CURRENT_VERSION', '5.0.0.1' );
20
}
21
22
if ( ! class_exists( 'GADWP_Manager' ) ) {
4
* Plugin URI: https://deconf.com
5
* Description: Displays Google Analytics Reports and Real-Time Statistics in your Dashboard. Automatically inserts the tracking code in every page of your website.
6
* Author: Alin Marcu
7
+ * Version: 5.0.1
8
* Author URI: https://deconf.com
9
* Text Domain: google-analytics-dashboard-for-wp
10
* Domain Path: /languages
16
17
// Plugin Version
18
if ( ! defined( 'GADWP_CURRENT_VERSION' ) ) {
19
+ define( 'GADWP_CURRENT_VERSION', '5.0.1' );
20
}
21
22
if ( ! class_exists( 'GADWP_Manager' ) ) {
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: deconf
3
Donate link: https://deconf.com/donate/
4
Tags: analytics,google analytics,google analytics dashboard,google analytics plugin,google analytics widget
5
Requires at least: 3.5
6
- Tested up to: 4.7.5
7
- Stable tag: 5.0.0.1
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
@@ -151,11 +151,20 @@ This is a major update, please read the [release notes](https://deconf.com/googl
151
152
== Changelog ==
153
154
= 5.0.0.1 =
155
* Bug Fixes:
156
* filedsObject is missing for the create command
157
* display the last accessed report instead of the default one
158
-
159
= 5.0 =
160
* Release notes: [GADWP 5.0](https://deconf.com/google-analytics-dashboard-for-wp-5-0-release-notes/)
161
* Enhancements:
3
Donate link: https://deconf.com/donate/
4
Tags: analytics,google analytics,google analytics dashboard,google analytics plugin,google analytics widget
5
Requires at least: 3.5
6
+ Tested up to: 4.8
7
+ Stable tag: 5.0.1
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
151
152
== Changelog ==
153
154
+ = 5.0.1 =
155
+ * Enhancements:
156
+ * use site_url() to find the main domain name
157
+ * display the page load time in seconds with two decimals
158
+ * add custom categories, custom actions, and custom labels support for events tracking using <em>data-ga-*</em> attributes; props by [Timo Schneider](https://github.com/tschneid)
159
+ * display the update notice only on automatic updates
160
+ * Bug Fixes:
161
+ * prevent the default action of the click event to be triggered if the anchor click event was already prevented by other scripts
162
+
163
= 5.0.0.1 =
164
* Bug Fixes:
165
* filedsObject is missing for the create command
166
* display the last accessed report instead of the default one
167
+
168
= 5.0 =
169
* Release notes: [GADWP 5.0](https://deconf.com/google-analytics-dashboard-for-wp-5-0-release-notes/)
170
* Enhancements:
tools/gapi.php CHANGED
@@ -47,7 +47,7 @@ if ( ! class_exists( 'GADWP_GAPI_Controller' ) ) {
47
}
48
}
49
$this->client = new Google_Client( $config );
50
- $this->client->setScopes( 'https://www.googleapis.com/auth/analytics.readonly' );
51
$this->client->setAccessType( 'offline' );
52
$this->client->setApplicationName( 'Google Analytics Dashboard' );
53
$this->client->setRedirectUri( 'urn:ietf:wg:oauth:2.0:oob' );
@@ -151,31 +151,31 @@ if ( ! class_exists( 'GADWP_GAPI_Controller' ) ) {
151
$authUrl = $this->client->createAuthUrl();
152
?>
153
<form name="input" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>" method="post">
154
- <table class="gadwp-settings-options">
155
- <tr>
156
- <td colspan="2" class="gadwp-settings-info">
157
<?php echo __( "Use this link to get your access code:", 'google-analytics-dashboard-for-wp' ) . ' <a href="' . $authUrl . '" id="gapi-access-code" target="_blank">' . __ ( "Get Access Code", 'google-analytics-dashboard-for-wp' ) . '</a>.'; ?>
158
</td>
159
- </tr>
160
- <tr>
161
- <td class="gadwp-settings-title">
162
- <label for="ga_dash_code" title="<?php _e("Use the red link to get your access code!",'google-analytics-dashboard-for-wp')?>"><?php echo _e( "Access Code:", 'google-analytics-dashboard-for-wp' ); ?></label>
163
- </td>
164
- <td>
165
- <input type="text" id="ga_dash_code" name="ga_dash_code" value="" size="61" required="required" title="<?php _e("Use the red link to get your access code!",'google-analytics-dashboard-for-wp')?>">
166
- </td>
167
- </tr>
168
- <tr>
169
- <td colspan="2">
170
- <hr>
171
- </td>
172
- </tr>
173
- <tr>
174
- <td colspan="2">
175
- <input type="submit" class="button button-secondary" name="ga_dash_authorize" value="<?php _e( "Save Access Code", 'google-analytics-dashboard-for-wp' ); ?>" />
176
- </td>
177
- </tr>
178
- </table>
179
</form>
180
<?php
181
}
@@ -455,7 +455,7 @@ if ( ! class_exists( 'GADWP_GAPI_Controller' ) ) {
455
$gadwp_data[4] = number_format_i18n( $gadwp_data[4] );
456
$gadwp_data[5] = number_format_i18n( $gadwp_data[5], 2 );
457
$gadwp_data[6] = gmdate( "H:i:s", $gadwp_data[6] );
458
- $gadwp_data[7] = gmdate( "H:i:s", $gadwp_data[7] );
459
if ( $filter ) {
460
$gadwp_data[8] = number_format_i18n( $gadwp_data[8], 2 ) . '%';
461
} else {
47
}
48
}
49
$this->client = new Google_Client( $config );
50
+ $this->client->setScopes( array( 'https://www.googleapis.com/auth/analytics.readonly', 'https://www.googleapis.com/auth/analytics.edit' ) );
51
$this->client->setAccessType( 'offline' );
52
$this->client->setApplicationName( 'Google Analytics Dashboard' );
53
$this->client->setRedirectUri( 'urn:ietf:wg:oauth:2.0:oob' );
151
$authUrl = $this->client->createAuthUrl();
152
?>
153
<form name="input" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>" method="post">
154
+ <table class="gadwp-settings-options">
155
+ <tr>
156
+ <td colspan="2" class="gadwp-settings-info">
157
<?php echo __( "Use this link to get your access code:", 'google-analytics-dashboard-for-wp' ) . ' <a href="' . $authUrl . '" id="gapi-access-code" target="_blank">' . __ ( "Get Access Code", 'google-analytics-dashboard-for-wp' ) . '</a>.'; ?>
158
</td>
159
+ </tr>
160
+ <tr>
161
+ <td class="gadwp-settings-title">
162
+ <label for="ga_dash_code" title="<?php _e("Use the red link to get your access code!",'google-analytics-dashboard-for-wp')?>"><?php echo _e( "Access Code:", 'google-analytics-dashboard-for-wp' ); ?></label>
163
+ </td>
164
+ <td>
165
+ <input type="text" id="ga_dash_code" name="ga_dash_code" value="" size="61" required="required" title="<?php _e("Use the red link to get your access code!",'google-analytics-dashboard-for-wp')?>">
166
+ </td>
167
+ </tr>
168
+ <tr>
169
+ <td colspan="2">
170
+ <hr>
171
+ </td>
172
+ </tr>
173
+ <tr>
174
+ <td colspan="2">
175
+ <input type="submit" class="button button-secondary" name="ga_dash_authorize" value="<?php _e( "Save Access Code", 'google-analytics-dashboard-for-wp' ); ?>" />
176
+ </td>
177
+ </tr>
178
+ </table>
179
</form>
180
<?php
181
}
455
$gadwp_data[4] = number_format_i18n( $gadwp_data[4] );
456
$gadwp_data[5] = number_format_i18n( $gadwp_data[5], 2 );
457
$gadwp_data[6] = gmdate( "H:i:s", $gadwp_data[6] );
458
+ $gadwp_data[7] = number_format_i18n( $gadwp_data[7], 2 );
459
if ( $filter ) {
460
$gadwp_data[8] = number_format_i18n( $gadwp_data[8], 2 ) . '%';
461
} else {
tools/tools.php CHANGED
@@ -45,10 +45,15 @@ if ( ! class_exists( 'GADWP_Tools' ) ) {
45
}
46
}
47
48
- public static function get_root_domain( $domain ) {
49
- $root = explode( '/', $domain );
50
- preg_match( "/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})#x2F;i", str_ireplace( 'www', '', isset( $root[2] ) ? $root[2] : $domain ), $root );
51
- return $root;
52
}
53
54
public static function strip_protocol( $domain ) {
45
}
46
}
47
48
+ public static function get_root_domain() {
49
+ $url = site_url();
50
+ $root = explode( '/', $url );
51
+ preg_match( '/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})#x2F;i', str_ireplace( 'www', '', isset( $root[2] ) ? $root[2] : $url ), $root );
52
+ if ( isset( $root['domain'] ) ) {
53
+ return $root['domain'];
54
+ } else {
55
+ return '';
56
+ }
57
}
58
59
public static function strip_protocol( $domain ) {