Google Analyticator - Version 4.3.4

Version Description

  • Fixes a bug that was breaking the save button on the settings page in IE.
  • Prevents the widget from grabbing Analytics data earlier January 1, 2005.
  • Fixes an incorrect default state for the event tracking option.
  • Adds the date range used for widget data in an HTML comment to prevent misrepresented stats.
Download this release

Release Info

Developer jesse_altman
Plugin Icon 128x128 Google Analyticator
Version 4.3.4
Comparing to
See all releases

Code changes from version 4.3.3 to 4.3.4

class.analytics.stats.php CHANGED
@@ -141,6 +141,9 @@ class GoogleAnalyticsStats
141
  **/
142
  function getMetric($metric, $startDate, $endDate)
143
  {
 
 
 
144
  # Request the list of accounts
145
  $response = $this->curl($this->baseFeed . "/data?ids=$this->accountId&start-date=$startDate&end-date=$endDate&metrics=$metric", false, '0');
146
 
@@ -158,6 +161,20 @@ class GoogleAnalyticsStats
158
  }
159
  }
160
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
  } // END class
162
 
163
  ?>
141
  **/
142
  function getMetric($metric, $startDate, $endDate)
143
  {
144
+ # Ensure the start date is after Jan 1 2005
145
+ $startDate = $this->verifyStartDate($startDate);
146
+
147
  # Request the list of accounts
148
  $response = $this->curl($this->baseFeed . "/data?ids=$this->accountId&start-date=$startDate&end-date=$endDate&metrics=$metric", false, '0');
149
 
161
  }
162
  }
163
 
164
+ /**
165
+ * Checks the date against Jan. 1 2005 because GA API only works until that date
166
+ *
167
+ * @param date - the date to compare
168
+ * @return the correct date
169
+ **/
170
+ function verifyStartDate($date)
171
+ {
172
+ if ( strtotime($date) > strtotime('2005-01-01') )
173
+ return $date;
174
+ else
175
+ return '2005-01-01';
176
+ }
177
+
178
  } // END class
179
 
180
  ?>
google-analyticator.php CHANGED
@@ -1,14 +1,14 @@
1
  <?php
2
  /*
3
  * Plugin Name: Google Analyticator
4
- * Version: 4.3.3
5
  * Plugin URI: http://plugins.spiralwebconsulting.com/analyticator.html
6
  * Description: Adds the necessary JavaScript code to enable <a href="http://www.google.com/analytics/">Google's Analytics</a>. After enabling this plugin visit <a href="options-general.php?page=google-analyticator.php">the settings page</a> and enter your Google Analytics' UID and enable logging.
7
  * Author: Spiral Web Consulting
8
  * Author URI: http://spiralwebconsulting.com/
9
  */
10
 
11
- define('GOOGLE_ANALYTICATOR_VERSION', '4.3.2');
12
 
13
  # Include Google Analytics Stats widget
14
  if ( function_exists('curl_init') ) {
@@ -51,7 +51,7 @@ define("ga_admin_level_default", 8, true);
51
  define("ga_adsense_default", "", true);
52
  define("ga_extra_default", "", true);
53
  define("ga_extra_after_default", "", true);
54
- define("ga_event_default", ga_enable, true);
55
  define("ga_outbound_default", ga_enabled, true);
56
  define("ga_outbound_prefix_default", 'outgoing', true);
57
  define("ga_downloads_default", "", true);
@@ -236,17 +236,19 @@ function ga_options_page() {
236
  ?>
237
 
238
  <div class="wrap">
239
- <form method="post" action="options-general.php?page=google-analyticator.php">
240
- <h2>Google Analyticator Settings</h2>
241
 
242
- <div style="float: right;">
243
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
244
- <input type="hidden" name="cmd" value="_s-xclick">
245
- <input type="hidden" name="hosted_button_id" value="6309412">
246
- <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
247
- <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
248
- </form>
249
- </div>
 
 
 
 
250
 
251
  <p><em>
252
  Google Analyticator is brought to you for free by <a href="http://spiralwebconsulting.com/">Spiral Web Consulting</a>. Spiral Web Consulting is a small web development firm specializing in PHP development. Visit our website to learn more, and don't hesitate to ask us to develop your next big WordPress plugin idea.
@@ -581,7 +583,7 @@ function ga_options_page() {
581
  </table>
582
  <p class="submit">
583
  <?php if ( function_exists('settings_fields') ) settings_fields('google-analyticator'); ?>
584
- <input type='submit' name='info_update' value='Save Changes' />
585
  </p>
586
  </div>
587
  </form>
1
  <?php
2
  /*
3
  * Plugin Name: Google Analyticator
4
+ * Version: 4.3.4
5
  * Plugin URI: http://plugins.spiralwebconsulting.com/analyticator.html
6
  * Description: Adds the necessary JavaScript code to enable <a href="http://www.google.com/analytics/">Google's Analytics</a>. After enabling this plugin visit <a href="options-general.php?page=google-analyticator.php">the settings page</a> and enter your Google Analytics' UID and enable logging.
7
  * Author: Spiral Web Consulting
8
  * Author URI: http://spiralwebconsulting.com/
9
  */
10
 
11
+ define('GOOGLE_ANALYTICATOR_VERSION', '4.3.4');
12
 
13
  # Include Google Analytics Stats widget
14
  if ( function_exists('curl_init') ) {
51
  define("ga_adsense_default", "", true);
52
  define("ga_extra_default", "", true);
53
  define("ga_extra_after_default", "", true);
54
+ define("ga_event_default", ga_enabled, true);
55
  define("ga_outbound_default", ga_enabled, true);
56
  define("ga_outbound_prefix_default", 'outgoing', true);
57
  define("ga_downloads_default", "", true);
236
  ?>
237
 
238
  <div class="wrap">
 
 
239
 
240
+ <h2>Google Analyticator Settings</h2>
241
+
242
+ <div style="float: right;">
243
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
244
+ <input type="hidden" name="cmd" value="_s-xclick">
245
+ <input type="hidden" name="hosted_button_id" value="6309412">
246
+ <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
247
+ <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
248
+ </form>
249
+ </div>
250
+
251
+ <form method="post" action="options-general.php?page=google-analyticator.php">
252
 
253
  <p><em>
254
  Google Analyticator is brought to you for free by <a href="http://spiralwebconsulting.com/">Spiral Web Consulting</a>. Spiral Web Consulting is a small web development firm specializing in PHP development. Visit our website to learn more, and don't hesitate to ask us to develop your next big WordPress plugin idea.
583
  </table>
584
  <p class="submit">
585
  <?php if ( function_exists('settings_fields') ) settings_fields('google-analyticator'); ?>
586
+ <input type="submit" name="info_update" value="Save Changes" />
587
  </p>
588
  </div>
589
  </form>
google-analytics-stats-widget.php CHANGED
@@ -34,6 +34,7 @@ class GoogleStatsWidget extends WP_Widget
34
  echo $before_title . $title . $after_title;
35
 
36
  # Make the stats chicklet
 
37
  $this->initiateBackground($pageBg, $font);
38
  $this->beginWidget($font, $widgetBg);
39
  $this->widgetInfo($this->getUniqueVisitors($acnt, $timeFrame), $line1, $line2, $innerBg, $font);
34
  echo $before_title . $title . $after_title;
35
 
36
  # Make the stats chicklet
37
+ echo '<!--Data gathered from last ' . number_format($timeFrame) . ' days using Google Analyticator -->';
38
  $this->initiateBackground($pageBg, $font);
39
  $this->beginWidget($font, $widgetBg);
40
  $this->widgetInfo($this->getUniqueVisitors($acnt, $timeFrame), $line1, $line2, $innerBg, $font);
google-analytics-stats.php CHANGED
@@ -42,6 +42,7 @@ class GoogleStatsWidget
42
  echo $before_title . $options['title'] . $after_title;
43
 
44
  # Make the stats chicklet
 
45
  $this->initiateBackground($options['pageBg'], $options['font']);
46
  $this->beginWidget($options['font'], $options['widgetBg']);
47
  $this->widgetInfo($this->getUniqueVisitors($options['account'], $options['timeFrame']), $options['line1'], $options['line2'], $options['innerBg'], $options['font']);
42
  echo $before_title . $options['title'] . $after_title;
43
 
44
  # Make the stats chicklet
45
+ echo '<!--Data gathered from last ' . number_format($options['timeFrame']) . ' days using Google Analyticator -->';
46
  $this->initiateBackground($options['pageBg'], $options['font']);
47
  $this->beginWidget($options['font'], $options['widgetBg']);
48
  $this->widgetInfo($this->getUniqueVisitors($options['account'], $options['timeFrame']), $options['line1'], $options['line2'], $options['innerBg'], $options['font']);
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://plugins.spiralwebconsulting.com/analyticator.html#donate
4
  Tags: stats, statistics, google, analytics, google analytics, tracking, widget
5
  Requires at least: 2.7
6
  Tested up to: 2.8.1
7
- Stable tag: 4.3.3
8
 
9
  Adds the necessary JavaScript code to enable Google Analytics.
10
 
@@ -45,6 +45,12 @@ Please visit the [Google Analyticator plugin page](http://plugins.spiralwebconsu
45
 
46
  == Changelog ==
47
 
 
 
 
 
 
 
48
  = 4.3.3 =
49
  * Corrects XHTML validator errors present in the stat widget.
50
  * Removes some stray code.
4
  Tags: stats, statistics, google, analytics, google analytics, tracking, widget
5
  Requires at least: 2.7
6
  Tested up to: 2.8.1
7
+ Stable tag: 4.3.4
8
 
9
  Adds the necessary JavaScript code to enable Google Analytics.
10
 
45
 
46
  == Changelog ==
47
 
48
+ = 4.3.4 =
49
+ * Fixes a bug that was breaking the save button on the settings page in IE.
50
+ * Prevents the widget from grabbing Analytics data earlier January 1, 2005.
51
+ * Fixes an incorrect default state for the event tracking option.
52
+ * Adds the date range used for widget data in an HTML comment to prevent misrepresented stats.
53
+
54
  = 4.3.3 =
55
  * Corrects XHTML validator errors present in the stat widget.
56
  * Removes some stray code.