Changeset 910037
- Timestamp:
- 05/07/2014 09:12:13 PM (12 years ago)
- Location:
- universal-analytics
- Files:
-
- 27 added
- 3 edited
-
tags/1.2.0 (added)
-
tags/1.2.0/LICENSE (added)
-
tags/1.2.0/README.md (added)
-
tags/1.2.0/assets (added)
-
tags/1.2.0/assets/gua-main.css (added)
-
tags/1.2.0/assets/gua-main.js (added)
-
tags/1.2.0/bootstrap (added)
-
tags/1.2.0/bootstrap/css (added)
-
tags/1.2.0/bootstrap/css/bootstrap-switch.min.css (added)
-
tags/1.2.0/bootstrap/css/bootstrap-theme.css (added)
-
tags/1.2.0/bootstrap/css/bootstrap-theme.css.map (added)
-
tags/1.2.0/bootstrap/css/bootstrap-theme.min.css (added)
-
tags/1.2.0/bootstrap/css/bootstrap.css (added)
-
tags/1.2.0/bootstrap/css/bootstrap.css.map (added)
-
tags/1.2.0/bootstrap/css/bootstrap.min.css (added)
-
tags/1.2.0/bootstrap/fonts (added)
-
tags/1.2.0/bootstrap/fonts/glyphicons-halflings-regular.eot (added)
-
tags/1.2.0/bootstrap/fonts/glyphicons-halflings-regular.svg (added)
-
tags/1.2.0/bootstrap/fonts/glyphicons-halflings-regular.ttf (added)
-
tags/1.2.0/bootstrap/fonts/glyphicons-halflings-regular.woff (added)
-
tags/1.2.0/bootstrap/js (added)
-
tags/1.2.0/bootstrap/js/bootstrap-switch.min.js (added)
-
tags/1.2.0/bootstrap/js/bootstrap.min.js (added)
-
tags/1.2.0/options.php (added)
-
tags/1.2.0/readme.txt (added)
-
tags/1.2.0/tracking-code.php (added)
-
tags/1.2.0/universalanalytics.php (added)
-
trunk/assets/gua-main.js (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/universalanalytics.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
universal-analytics/trunk/assets/gua-main.js
r908662 r910037 1 1 jQuery(document).ready(function(e) { 2 2 3 4 5 jQuery('#classic_plugin_switch').bootstrapSwitch('size', 'small'); 6 3 jQuery('#classic_plugin_switch').bootstrapSwitch('size', 'small'); 7 4 jQuery('#classic_plugin_switch').bootstrapSwitch('onColor', 'success'); 8 9 5 jQuery('#classic_plugin_switch').bootstrapSwitch('offColor', 'danger'); 10 6 11 12 13 7 jQuery('#plugin_switch').bootstrapSwitch('size', 'small'); 14 15 8 jQuery('#plugin_switch').bootstrapSwitch('onColor', 'success'); 16 17 9 jQuery('#plugin_switch').bootstrapSwitch('offColor', 'danger'); 18 10 19 20 21 11 jQuery('#custom_plugin_switch').bootstrapSwitch('size', 'small'); 22 23 12 jQuery('#custom_plugin_switch').bootstrapSwitch('onColor', 'success'); 24 25 13 jQuery('#custom_plugin_switch').bootstrapSwitch('offColor', 'danger'); 26 14 27 28 29 15 jQuery(function() { 30 31 16 jQuery('#save-gua-settings').click(function(e) { 32 33 var property_id = jQuery('#web_property_id').val(); 34 17 var property_id = jQuery('#web_property_id').val(); 35 18 var tracking_off_for_this_role = jQuery('#tracking_off_for_this_role').val(); 36 37 19 var ajax_url = jQuery('#ajax_url').val(); 38 20 39 21 if(jQuery('#in_footer').is(':checked')){ 40 41 22 var in_footer = 'on'; 42 43 23 }else{ 44 45 24 var in_footer = 'off'; 46 47 25 } 48 26 49 50 51 27 if(jQuery('#plugin_switch').is(':checked')){ 52 53 28 var plugin_switch = 'on'; 54 55 29 }else{ 56 57 30 var plugin_switch = 'off'; 58 59 31 } 60 32 61 62 63 33 if(jQuery('#track_links').is(':checked')){ 64 65 34 var track_links = 'on'; 66 67 35 }else{ 68 69 36 var track_links = 'off'; 70 71 37 } 72 38 73 39 if(jQuery('#enable_display').is(':checked')){ 40 var enable_display = 'on'; 41 }else{ 42 var enable_display = 'off'; 43 } 74 44 75 var enable_display = 'on';76 45 if(jQuery('#anonymize_ip').is(':checked')){ 46 var anonymize_ip = 'on'; 77 47 }else{ 78 79 var enable_display = 'off';80 81 }82 83 if(jQuery('#anonymize_ip').is(':checked')){84 85 var anonymize_ip = 'on';86 87 }else{88 89 48 var anonymize_ip = 'off'; 90 91 49 } 92 50 93 51 if(jQuery('#tracking_off_for_role').is(':checked')){ 94 95 52 var tracking_off_for_role = 'on'; 96 97 53 }else{ 98 99 54 var tracking_off_for_role = 'off'; 100 101 55 } 102 56 103 57 if(property_id.indexOf('UA-') == -1){ 104 105 58 jQuery('#web_property_id').parent('.col-sm-9').addClass('has-error'); 106 107 59 jQuery('.error').css('color', '#F00').removeClass('hide'); 108 60 109 61 }else{ 62 //alert('ok proceed on ajax'); 63 jQuery.ajax({ 64 url: ajax_url, 65 data: { 66 'action':'mdg_save_google_universal_analytics_settings', 67 'plugin_switch' : plugin_switch, 68 'in_footer' : in_footer, 69 'property_id' : property_id, 70 'track_links' : track_links, 71 'enable_display' : enable_display, 72 'anonymize_ip' : anonymize_ip, 73 'tracking_off_for_role' : tracking_off_for_role, 74 'tracking_off_for_this_role' : tracking_off_for_this_role 75 }, 110 76 111 }else{ 77 success:function(data) { 78 jQuery('#web_property_id').parent('.has-error').removeClass('has-error'); 79 jQuery('.error').addClass('hide'); 80 jQuery('.form-horizontal .alert').fadeIn().removeClass('hide'); 81 jQuery('.form-horizontal .alert').delay(3000).fadeOut(500); 112 82 113 //alert('ok proceed on ajax'); 114 115 jQuery.ajax({ 116 117 url: ajax_url, 118 119 data: { 120 121 'action':'mdg_save_google_universal_analytics_settings', 122 123 'plugin_switch' : plugin_switch, 124 125 'in_footer' : in_footer, 126 127 'property_id' : property_id, 128 129 'track_links' : track_links, 130 131 'enable_display' : enable_display, 132 133 'anonymize_ip' : anonymize_ip, 134 135 'tracking_off_for_role' : tracking_off_for_role, 136 137 'tracking_off_for_this_role' : tracking_off_for_this_role 138 139 }, 140 141 success:function(data) { 142 143 jQuery('#web_property_id').parent('.has-error').removeClass('has-error'); 144 145 jQuery('.error').addClass('hide'); 146 147 jQuery('.form-horizontal .alert').fadeIn().removeClass('hide'); 148 149 jQuery('.form-horizontal .alert').delay(3000).fadeOut(500); 150 151 152 153 }, 83 // this allows the page to reload and show any additional WP alerts 84 location.reload(); 85 }, 154 86 155 87 error: function(errorThrown){ 156 88 157 158 159 89 } 160 161 }); 162 163 164 165 166 90 }); 167 91 } 168 169 }); 170 92 }); 93 }); 171 94 }); 172 173 174 175 176 177 jQuery(function() {178 179 jQuery('#save-custom-settings').click(function(e) {180 181 var custom_web_property_id = jQuery('#custom_web_property_id').val();182 183 var custom_tracking_off_for_this_role = jQuery('#custom_tracking_off_for_this_role').val();184 185 var ajax_url = jQuery('#ajax_url').val();186 187 if(jQuery('#custom_in_footer').is(':checked')){188 189 var custom_in_footer = 'on';190 191 }else{192 193 var custom_in_footer = 'off';194 195 }196 197 198 199 if(jQuery('#custom_plugin_switch').is(':checked')){200 201 var custom_plugin_switch = 'on';202 203 }else{204 205 var custom_plugin_switch = 'off';206 207 }208 209 210 211 if(jQuery('#custom_tracking_off_for_role').is(':checked')){212 213 var custom_tracking_off_for_role = 'on';214 215 }else{216 217 var custom_tracking_off_for_role = 'off';218 219 }220 221 //alert('ok proceed on ajax');222 223 jQuery.ajax({224 225 url: ajax_url,226 227 data: {228 229 'action':'mdg_save_google_custom_analytics_settings',230 231 'custom_in_footer' : custom_in_footer,232 233 'custom_plugin_switch' : custom_plugin_switch,234 235 'custom_web_property_id' : custom_web_property_id,236 237 'custom_tracking_off_for_role' : custom_tracking_off_for_role,238 239 'custom_tracking_off_for_this_role' : custom_tracking_off_for_this_role240 241 },242 243 success:function(data) {244 245 jQuery('.form-horizontal .alert').fadeIn().removeClass('hide');246 247 jQuery('.form-horizontal .alert').delay(3000).fadeOut(500);248 249 250 251 },252 253 error: function(errorThrown){254 255 256 257 }258 259 });260 261 262 263 264 265 266 267 });268 269 });270 271 272 273 jQuery(function(){274 275 276 277 //classic settings event278 279 280 281 jQuery('#save-classic-settings').click(function(e) {282 283 284 285 var classic_property_id = jQuery('#classic_web_property_id').val();286 287 var classic_tracking_off_for_this_role = jQuery('#classic_tracking_off_for_this_role').val();288 289 290 291 var ajax_url = jQuery('#ajax_url').val();292 293 if(jQuery('#classic_in_footer').is(':checked')){294 295 var classic_in_footer = 'on';296 297 }else{298 299 var classic_in_footer = 'off';300 301 }302 303 304 305 if(jQuery('#classic_plugin_switch').is(':checked')){306 307 var classic_plugin_switch = 'on';308 309 }else{310 311 var classic_plugin_switch = 'off';312 313 }314 315 316 317 if(jQuery('#classic_tracking_off_for_role').is(':checked')){318 319 var classic_tracking_off_for_role = 'on';320 321 }else{322 323 var classic_tracking_off_for_role = 'off';324 325 }326 327 if(classic_property_id.indexOf('UA-') == -1){328 329 jQuery('#classic_web_property_id').parent('.col-sm-9').addClass('has-error');330 331 jQuery('.error').css('color', '#F00').removeClass('hide');332 333 334 335 }else{336 337 //alert('ok proceed on ajax');338 339 jQuery.ajax({340 341 url: ajax_url,342 343 data: {344 345 'action':'mdg_save_google_classic_analytics_settings',346 347 'classic_plugin_switch' : classic_plugin_switch,348 349 'classic_in_footer' : classic_in_footer,350 351 'classic_property_id' : classic_property_id,352 353 'classic_tracking_off_for_role' : classic_tracking_off_for_role,354 355 'classic_tracking_off_for_this_role' : classic_tracking_off_for_this_role356 357 },358 359 success:function(data) {360 361 jQuery('#classic_web_property_id').parent('.has-error').removeClass('has-error');362 363 jQuery('.error').addClass('hide');364 365 jQuery('.form-horizontal .alert').fadeIn().removeClass('hide');366 367 jQuery('.form-horizontal .alert').delay(3000).fadeOut(500);368 369 370 371 },372 373 error: function(errorThrown){374 375 376 377 }378 379 });380 381 382 383 384 385 }386 387 });388 389 });390 391 392 393 394 395 }); -
universal-analytics/trunk/readme.txt
r909009 r910037 4 4 Requires at least: 3.0 5 5 Tested up to: 3.9 6 Stable tag: 1. 0.16 Stable tag: 1.2.0 7 7 License: GPLv2 or later 8 8 … … 42 42 == Changelog == 43 43 44 = 1.0.0 = 45 * Initial release. 44 = 1.2.0 = 45 * Added alert to walk you through setup 46 * Added alert to let you know if the plugin is turned 'Off' 46 47 47 48 = 1.0.1 = 48 49 * Fixed bug with plugin folder that didn't allow plugin to load. 49 50 51 = 1.0.0 = 52 * Initial release. 53 50 54 == Upgrade Notice == 55 56 = 1.2.0 = 57 * Added alert to walk you through setup 58 * Added alert to let you know if the plugin is turned 'Off' 59 60 = 1.0.1 = 61 * Fixed bug with plugin folder that didn't allow plugin to load. 51 62 52 63 = 1.0.0 = 53 64 * Initial release. 54 55 = 1.0.1 =56 * Fixed bug with plugin folder that didn't allow plugin to load. -
universal-analytics/trunk/universalanalytics.php
r909009 r910037 4 4 Plugin URI: http://wordpress.org/extend/plugins/universal-analytics/ 5 5 Description: A simple method to add Google's Universal Analytics JavaScript tracking code to your WordPress website. 6 Version: 1. 0.16 Version: 1.2.0 7 7 Author: Matchbox Design Group 8 8 Author URI: http://matchboxdesigngroup.com/ … … 148 148 149 149 add_action( 'wp_ajax_mdg_save_google_universal_analytics_settings', 'mdg_save_google_universal_analytics_settings' ); 150 151 152 // Alerts 153 // Display an error message when Universal Analytics hasn't been setup. 154 function mdg_google_universal_analytics_check() { 155 $plugin_switch = get_option('plugin_switch')=='off'; 156 $property_id = get_option('web_property_id'); 157 158 if (!$property_id){ 159 echo "<div id='message' class='error'>"; 160 echo "<p><strong>" . __( "Almost there: Now you need add your Tracking ID to Universal Analytics.", 'mdg-universal-analytics' ) . "</strong> " . sprintf( __( "Go to your %sGoogle Analytics Settings%s and add your information.", 'mdg-universal-analytics' ), "<a href='" . admin_url( 'options-general.php?page=mdg_google_universal_analytics' ) . "'>", "</a>" ) . "</p></div>"; 161 }elseif ($plugin_switch) { 162 echo "<div id='message' class='error'>"; 163 echo "<p><strong>" . __( "Whoa there partner: Universal Analytics is turned off.", 'mdg-universal-analytics' ) . "</strong> " . sprintf( __( "This means you aren't tracking your site. Go to your %sGoogle Analytics Settings%s and change the Status to ON", 'mdg-universal-analytics' ), "<a href='" . admin_url( 'options-general.php?page=mdg_google_universal_analytics' ) . "'>", "</a>" ) . "</p></div>"; 164 } 165 } 166 167 function mdg_google_universal_analytics_admin_check() { 168 mdg_google_universal_analytics_check(); 169 } 170 add_action( 'admin_head', 'mdg_google_universal_analytics_admin_check' ); 150 171 ?>
Note: See TracChangeset
for help on using the changeset viewer.