Google Analytics for WordPress by MonsterInsights - Version 2.9.4

Version Description

  • Changed to the new Changelog design.
  • Removed pre 2.6 compatibility code, plugin now requires WP 2.6 or higher.
  • Small changes to the admin screen.
Download this release

Release Info

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

Code changes from version 2.9.3 to 2.9.4

Files changed (2) hide show
  1. googleanalytics.php +65 -35
  2. readme.txt +61 -23
googleanalytics.php CHANGED
@@ -4,24 +4,15 @@ Plugin Name: Google Analytics for WordPress
4
  Plugin URI: http://yoast.com/wordpress/analytics/
5
  Description: This plugin makes it simple to add Google Analytics with extra search engines and automatic clickout and download tracking to your WordPress blog.
6
  Author: Joost de Valk
7
- Version: 2.9.3
 
8
  Author URI: http://yoast.com/
9
  License: GPL
10
 
11
- Originally based on Rich Boakes' Analytics plugin: http://boakes.org/analytics
12
-
13
  */
14
 
15
- // Pre-2.6 compatibility
16
- if ( !defined('WP_CONTENT_URL') )
17
- define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content');
18
- if ( !defined('WP_CONTENT_DIR') )
19
- define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
20
-
21
- // Guess the location
22
- $gapppluginpath = WP_CONTENT_URL.'/plugins/'.plugin_basename(dirname(__FILE__)).'/';
23
-
24
- $uastring = "UA-00000-0";
25
 
26
  /*
27
  * Admin User Interface
@@ -32,13 +23,10 @@ if ( ! class_exists( 'GA_Admin' ) ) {
32
  class GA_Admin {
33
 
34
  function add_config_page() {
35
- global $wpdb;
36
- if ( function_exists('add_submenu_page') ) {
37
- $plugin_page = add_submenu_page('plugins.php', 'Google Analytics for WordPress Configuration', 'Google Analytics', 9, basename(__FILE__), array('GA_Admin','config_page'));
38
- add_action( 'admin_head-'. $plugin_page, array('GA_Admin','config_page_head') );
39
- add_filter( 'plugin_action_links', array( 'GA_Admin', 'filter_plugin_actions'), 10, 2 );
40
- add_filter( 'ozh_adminmenu_icon', array( 'GA_Admin', 'add_ozh_adminmenu_icon' ) );
41
- }
42
  } // end add_GA_config_page()
43
 
44
  function add_ozh_adminmenu_icon( $hook ) {
@@ -143,27 +131,20 @@ if ( ! class_exists( 'GA_Admin' ) ) {
143
  echo "<div id=\"message\" class=\"updated\"><p>Google Analytics settings updated.</p></div>\n";
144
  }
145
 
146
- $templates = array();
147
- $templates[] = "footer.php";
148
- $file = file_get_contents(locate_template($templates));
149
- // Check for wp_footer
150
- preg_match('/.*(wp_footer\(\);).*/',$file,$matches);
151
- if (!$matches[1]) {
152
- echo "<div id=\"message\" class=\"error\"><p><strong>Warning</strong> wp_footer(); not found in your footer.php file, this might mean this plugin will not work!</p></div>\n";
153
- }
154
-
155
  $options = get_option('GoogleAnalyticsPP');
156
  ?>
157
  <div class="wrap">
 
158
  <h2>Google Analytics for WordPress Configuration</h2>
159
- <iframe style="float: right; width: 200px; height: 250px" src="http://yoast.com/wp/google-analytics.php"></iframe>
160
-
161
- <form action="" method="post" id="analytics-conf">
162
- <table class="form-table" style="clear:none;">
163
  <?php
164
- if ( function_exists('wp_nonce_field') )
165
- wp_nonce_field('analyticspp-config');
166
  ?>
 
 
 
 
167
  <tr>
168
  <th scope="row" style="width:250px;" valign="top">
169
  <label for="uastring">Analytics Account ID</label> &nbsp; &nbsp; &nbsp; <small><a href="#" id="explain">What's this?</a></small>
@@ -661,5 +642,54 @@ if ($options['rsslinktagging']) {
661
  add_filter ( 'the_permalink_rss', array('GA_Filter','rsslinktagger'), 99 );
662
  }
663
 
 
 
 
 
 
 
 
 
664
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
665
  ?>
4
  Plugin URI: http://yoast.com/wordpress/analytics/
5
  Description: This plugin makes it simple to add Google Analytics with extra search engines and automatic clickout and download tracking to your WordPress blog.
6
  Author: Joost de Valk
7
+ Version: 2.9.4
8
+ Requires at least: 2.6
9
  Author URI: http://yoast.com/
10
  License: GPL
11
 
 
 
12
  */
13
 
14
+ // Determine the location
15
+ $gapppluginpath = plugins_url('', __FILE__).'/';
 
 
 
 
 
 
 
 
16
 
17
  /*
18
  * Admin User Interface
23
  class GA_Admin {
24
 
25
  function add_config_page() {
26
+ $plugin_page = add_submenu_page('plugins.php', 'Google Analytics for WordPress Configuration', 'Google Analytics', 9, basename(__FILE__), array('GA_Admin','config_page'));
27
+ add_action( 'admin_head-'. $plugin_page, array('GA_Admin','config_page_head') );
28
+ add_filter( 'plugin_action_links', array( 'GA_Admin', 'filter_plugin_actions'), 10, 2 );
29
+ add_filter( 'ozh_adminmenu_icon', array( 'GA_Admin', 'add_ozh_adminmenu_icon' ) );
 
 
 
30
  } // end add_GA_config_page()
31
 
32
  function add_ozh_adminmenu_icon( $hook ) {
131
  echo "<div id=\"message\" class=\"updated\"><p>Google Analytics settings updated.</p></div>\n";
132
  }
133
 
 
 
 
 
 
 
 
 
 
134
  $options = get_option('GoogleAnalyticsPP');
135
  ?>
136
  <div class="wrap">
137
+ <?php screen_icon('tools'); ?>
138
  <h2>Google Analytics for WordPress Configuration</h2>
139
+ <div style="width: 250px; float:right;">
140
+ <h3>The latest news on Yoast</h3>
 
 
141
  <?php
142
+ yst_db_widget('small', 2, 150, false);
 
143
  ?>
144
+ </div>
145
+ <form action="" method="post" id="analytics-conf">
146
+ <table class="form-table" style="clear:none;">
147
+ <?php wp_nonce_field('analyticspp-config'); ?>
148
  <tr>
149
  <th scope="row" style="width:250px;" valign="top">
150
  <label for="uastring">Analytics Account ID</label> &nbsp; &nbsp; &nbsp; <small><a href="#" id="explain">What's this?</a></small>
642
  add_filter ( 'the_permalink_rss', array('GA_Filter','rsslinktagger'), 99 );
643
  }
644
 
645
+ function yst_text_limit( $text, $limit, $finish = ' [&hellip;]') {
646
+ if( strlen( $text ) > $limit ) {
647
+ $text = substr( $text, 0, $limit );
648
+ $text = substr( $text, 0, - ( strlen( strrchr( $text,' ') ) ) );
649
+ $text .= $finish;
650
+ }
651
+ return $text;
652
+ }
653
 
654
+ function yst_db_widget($image = 'normal', $num = 3, $excerptsize = 250, $showdate = true) {
655
+ require_once(ABSPATH.WPINC.'/rss.php');
656
+ if ( $rss = fetch_rss( 'http://feeds2.feedburner.com/joostdevalk' ) ) {
657
+ echo '<div class="rss-widget">';
658
+ if ($image != 'small') {
659
+ echo '<a href="http://yoast.com/" title="Go to Yoast.com"><img src="http://cdn.yoast.com/yoast-logo-rss.png" class="alignright" alt="Yoast"/></a>';
660
+ } else {
661
+ echo '<a href="http://yoast.com/" title="Go to Yoast.com"><img width="80" src="http://cdn.yoast.com/yoast-logo-rss.png" class="alignright" alt="Yoast"/></a>';
662
+ }
663
+ echo '<ul>';
664
+ if (!is_numeric($num)) {
665
+ $num = 3;
666
+ }
667
+ $rss->items = array_slice( $rss->items, 0, $num );
668
+ foreach ( (array) $rss->items as $item ) {
669
+ echo '<li>';
670
+ echo '<a class="rsswidget" href="'.clean_url( $item['link'], $protocolls=null, 'display' ).'">'. htmlentities($item['title']) .'</a> ';
671
+ if ($showdate)
672
+ echo '<span class="rss-date">'. date('F j, Y', strtotime($item['pubdate'])) .'</span>';
673
+ echo '<div class="rssSummary">'. yst_text_limit($item['summary'],$excerptsize) .'</div>';
674
+ echo '</li>';
675
+ }
676
+ echo '</ul>';
677
+ echo '<div style="border-top: 1px solid #ddd; padding-top: 10px; text-align:center;">';
678
+ echo '<a href="http://feeds2.feedburner.com/joostdevalk"><img src="'.get_bloginfo('wpurl').'/wp-includes/images/rss.png" alt=""/> Subscribe with RSS</a>';
679
+ if ($image != 'small') {
680
+ echo ' &nbsp; &nbsp; &nbsp; ';
681
+ } else {
682
+ echo '<br/>';
683
+ }
684
+ echo '<a href="http://yoast.com/email-blog-updates/"><img src="http://cdn.yoast.com/email_sub.png" alt=""/> Subscribe by email</a>';
685
+ echo '</div>';
686
+ echo '</div>';
687
+ }
688
+ }
689
+
690
+ function yst_widget_setup() {
691
+ wp_add_dashboard_widget( 'yst_db_widget' , 'The Latest news from Yoast' , 'yst_db_widget');
692
+ }
693
+
694
+ add_action('wp_dashboard_setup', 'yst_widget_setup');
695
  ?>
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://yoast.com/donate/
4
  Tags: analytics, google analytics, statistics
5
  Requires at least: 2.2
6
  Tested up to: 2.8
7
- Stable tag: 2.9.3
8
 
9
  The Google Analytics for WordPress plugin automatically tracks and segments all outbound links from within posts, comment author links, links within comments, blogroll links and downloads. It also allows you to track AdSense clicks, add extra search engines, track image search queries and it will even work together with Urchin.
10
 
@@ -29,28 +29,66 @@ This section describes how to install the plugin and get it working.
29
 
30
  == Changelog ==
31
 
32
- 1. 2.9.3: Added a new option for RSS link tagging, which allows you to tag your RSS feed links with RSS campaign variables. When you've set campaign variables to use # instead of ?, this will adhere to that setting too. Thanks to [Timan Rebel](http://rebelic.nl/) for the idea and code.
33
- 1. 2.9.2:
34
- * Added a check to see whether the wp_footer() call is in footer.php
35
- * Added a message to the source when tracking code is left out because user is logged in as admin
36
- * Added option to segment logged in users
37
- * Added try - catch to script lines like in new Google Analytics scripts
38
- * Fixed bug in warning when no UA code is entered
39
- * Prevent link tracking when admin is logged in and admin tracking is disabled
40
- * Now prevents parsing of non http and https link
41
- 1. 2.9: Re arranged admin panel to have "standard" and "advanced" settigns, added domain tracking, added fix for double onclick parameter, as suggest here: http://wordpress.org/support/topic/241757
42
- 1. 2.8: Added the option to add setAllowAnchor to the tracking code, allowing you to track campaigns with # instead of ?
43
- 1. 2.7: Added option to select either header of footer position, added new AdSense integration options, remove now unneeded adsense tracking script.
44
- 1. 2.6.6: Fixed settings link
45
- 1. 2.6.5: added Ozh admin menu icon and settings link
46
- 1. 2.6.4: fixes for 2.7
47
- 1. 2.6.3: fixed bug that didn't allow saving of outbound clicks from comments string
48
- 1. 2.6: fixed incompatibility with WP 2.6
49
- 1. 2.5.4: fixed an issue with pluginpath being used globally, and changed links to new domain.
50
- 1. 2.2: switched to the new tracking code
51
- 1. 2.1: made sure tracking was disabled on preview pages
52
- 1. 2.0: added AdSense tracking
53
- 1. 1.5: added option to enable admin tracking, off by default
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
  == Frequently Asked Questions ==
56
 
4
  Tags: analytics, google analytics, statistics
5
  Requires at least: 2.2
6
  Tested up to: 2.8
7
+ Stable tag: 2.9.4
8
 
9
  The Google Analytics for WordPress plugin automatically tracks and segments all outbound links from within posts, comment author links, links within comments, blogroll links and downloads. It also allows you to track AdSense clicks, add extra search engines, track image search queries and it will even work together with Urchin.
10
 
29
 
30
  == Changelog ==
31
 
32
+ = 2.9.4 =
33
+ * Changed to the new Changelog design.
34
+ * Removed pre 2.6 compatibility code, plugin now requires WP 2.6 or higher.
35
+ * Small changes to the admin screen.
36
+
37
+ = 2.9.3 =
38
+ * Added a new option for RSS link tagging, which allows you to tag your RSS feed links with RSS campaign variables. When you've set campaign variables to use # instead of ?, this will adhere to that setting too. Thanks to [Timan Rebel](http://rebelic.nl/) for the idea and code.
39
+
40
+ = 2.9.2: =
41
+ * Added a check to see whether the wp_footer() call is in footer.php.
42
+ * Added a message to the source when tracking code is left out because user is logged in as admin.
43
+ * Added option to segment logged in users.
44
+ * Added try - catch to script lines like in new Google Analytics scripts.
45
+ * Fixed bug in warning when no UA code is entered.
46
+ * Prevent link tracking when admin is logged in and admin tracking is disabled.
47
+ * Now prevents parsing of non http and https link.
48
+
49
+ = 2.9 =
50
+ * Re arranged admin panel to have "standard" and "advanced" settings.
51
+ * Added domain tracking.
52
+ * Added fix for double onclick parameter, as suggested [here](http://wordpress.org/support/topic/241757).
53
+
54
+ = 2.8 =
55
+ * Added the option to add setAllowAnchor to the tracking code, allowing you to track campaigns with # instead of ?.
56
+
57
+ = 2.7 =
58
+ * Added option to select either header of footer position.
59
+ * Added new AdSense integration options.
60
+ * Removed now unneeded adsense tracking script.
61
+
62
+ = 2.6.6=
63
+ * Fixed settings link.
64
+
65
+ = 2.6.5 =
66
+ * added Ozh admin menu icon and settings link.
67
+
68
+ = 2.6.4 =
69
+ * Fixes for 2.7.
70
+
71
+ = 2.6.3 =
72
+ * Fixed bug that didn't allow saving of outbound clicks from comments string.
73
+
74
+ = 2.6 =
75
+ * Fixed incompatibility with WP 2.6.
76
+
77
+ = 2.5.4 =
78
+ * Fixed an issue with pluginpath being used globally.
79
+ * Changed links to [new domain](http://yoast.com/).
80
+
81
+ = 2.2 =
82
+ * Switched to the new tracking code.
83
+
84
+ = 2.1 =
85
+ * Made sure tracking was disabled on preview pages.
86
+
87
+ = 2.0 =
88
+ * Added AdSense tracking.
89
+
90
+ = 1.5 =
91
+ * Added option to enable admin tracking, off by default.
92
 
93
  == Frequently Asked Questions ==
94