Changeset 918587
- Timestamp:
- 05/21/2014 10:13:31 AM (12 years ago)
- Location:
- google-universal-analytics
- Files:
-
- 25 added
- 8 edited
-
tags/2.3.0.2 (added)
-
tags/2.3.0.2/assets (added)
-
tags/2.3.0.2/assets/gua-main.css (added)
-
tags/2.3.0.2/assets/gua-main.js (added)
-
tags/2.3.0.2/bootstrap (added)
-
tags/2.3.0.2/bootstrap/css (added)
-
tags/2.3.0.2/bootstrap/css/bootstrap-switch.min.css (added)
-
tags/2.3.0.2/bootstrap/fonts (added)
-
tags/2.3.0.2/bootstrap/fonts/glyphicons-halflings-regular.eot (added)
-
tags/2.3.0.2/bootstrap/fonts/glyphicons-halflings-regular.svg (added)
-
tags/2.3.0.2/bootstrap/fonts/glyphicons-halflings-regular.ttf (added)
-
tags/2.3.0.2/bootstrap/fonts/glyphicons-halflings-regular.woff (added)
-
tags/2.3.0.2/bootstrap/js (added)
-
tags/2.3.0.2/bootstrap/js/bootstrap-switch.min.js (added)
-
tags/2.3.0.2/classic (added)
-
tags/2.3.0.2/classic/classic-analytics.php (added)
-
tags/2.3.0.2/classic/custom-analytics.php (added)
-
tags/2.3.0.2/googleanalytics.php (added)
-
tags/2.3.0.2/options.php (added)
-
tags/2.3.0.2/readme.txt (added)
-
tags/2.3.0.2/screenshot-1.png (added)
-
tags/2.3.0.2/screenshot-2.png (added)
-
tags/2.3.0.2/tracking-code.php (added)
-
tags/2.3.0.2/woo_code.php (added)
-
trunk/assets/gua-main.css (modified) (1 diff)
-
trunk/assets/gua-main.js (modified) (7 diffs)
-
trunk/classic/classic-analytics.php (modified) (1 diff)
-
trunk/classic/custom-analytics.php (modified) (1 diff)
-
trunk/googleanalytics.php (modified) (11 diffs)
-
trunk/options.php (modified) (4 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/tracking-code.php (modified) (1 diff)
-
trunk/woo_code.php (added)
Legend:
- Unmodified
- Added
- Removed
-
google-universal-analytics/trunk/assets/gua-main.css
r868884 r918587 5 5 6 6 7 .form-horizontal{ 8 font-size:14px; 9 } 7 10 .form-horizontal .alert{ 8 9 11 margin-left:10px; 10 11 padding:8px; 12 12 padding:8px; 13 13 14 } 15 .form-horizontal input[type="text"]{ 16 border: solid 1px #ddd; 17 box-shadow: inset 0 1px 2px rgba(0,0,0,.07); 18 background-color: #fff; 19 color: #333; 20 height: 34px; 21 padding: 6px 12px; 22 font-size: 14px; 23 line-height: 1.42857143; 24 width:350px; 25 border-radius:5px; 26 -webkit-border-radius:5px; 27 -moz-border-radius:5px; 28 } 29 .form-group{ 30 margin:15px 0; 31 } 32 .error{ 33 color:#F00; 34 display:block; 35 } 36 .hide{ 37 display:none; 38 } -
google-universal-analytics/trunk/assets/gua-main.js
r917494 r918587 1 1 jQuery(document).ready(function(e) { 2 2 /*jQuery( "#google-universal-options" ).submit(function( event ) { 3 4 var property_id = jQuery('#web_property_id').val(); 5 alert(property_id); 6 7 8 event.preventDefault(); 9 });*/ 3 10 4 11 5 12 jQuery('#classic_plugin_switch').bootstrapSwitch('size', 'small'); 6 7 13 jQuery('#classic_plugin_switch').bootstrapSwitch('onColor', 'success'); 8 9 14 jQuery('#classic_plugin_switch').bootstrapSwitch('offColor', 'danger'); 10 15 … … 12 17 13 18 jQuery('#plugin_switch').bootstrapSwitch('size', 'small'); 14 15 19 jQuery('#plugin_switch').bootstrapSwitch('onColor', 'success'); 16 17 20 jQuery('#plugin_switch').bootstrapSwitch('offColor', 'danger'); 18 21 … … 20 23 21 24 jQuery('#custom_plugin_switch').bootstrapSwitch('size', 'small'); 22 23 25 jQuery('#custom_plugin_switch').bootstrapSwitch('onColor', 'success'); 24 25 26 jQuery('#custom_plugin_switch').bootstrapSwitch('offColor', 'danger'); 26 27 … … 28 29 29 30 jQuery(function() { 30 31 31 jQuery('#save-gua-settings').click(function(e) { 32 33 32 var property_id = jQuery('#web_property_id').val(); 34 35 33 var tracking_off_for_this_role = jQuery('#tracking_off_for_this_role').val(); 36 37 34 var ajax_url = jQuery('#ajax_url').val(); 38 39 35 if(jQuery('#in_footer').is(':checked')){ 40 41 36 var in_footer = 'on'; 42 43 }else{ 44 37 }else{ 45 38 var in_footer = 'off'; 46 47 39 } 48 40 … … 50 42 51 43 if(jQuery('#plugin_switch').is(':checked')){ 52 53 44 var plugin_switch = 'on'; 54 55 }else{ 56 45 }else{ 57 46 var plugin_switch = 'off'; 58 59 47 } 60 48 … … 62 50 63 51 if(jQuery('#track_links').is(':checked')){ 64 65 52 var track_links = 'on'; 66 67 }else{ 68 53 }else{ 69 54 var track_links = 'off'; 70 71 55 } 72 56 73 57 if(jQuery('#enable_display').is(':checked')){ 74 75 58 var enable_display = 'on'; 76 77 }else{ 78 59 }else{ 79 60 var enable_display = 'off'; 80 81 61 } 82 62 83 63 if(jQuery('#anonymize_ip').is(':checked')){ 84 85 64 var anonymize_ip = 'on'; 86 87 }else{ 88 65 }else{ 89 66 var anonymize_ip = 'off'; 90 67 } 68 if(jQuery('#woo_tracking').is(':checked')){ 69 var woo_tracking = 'on'; 70 }else{ 71 var woo_tracking = 'off'; 91 72 } 92 73 93 74 if(jQuery('#tracking_off_for_role').is(':checked')){ 94 95 75 var tracking_off_for_role = 'on'; 96 76 … … 122 102 123 103 'plugin_switch' : plugin_switch, 124 125 104 'in_footer' : in_footer, 126 127 105 'property_id' : property_id, 128 129 106 'track_links' : track_links, 130 131 107 'enable_display' : enable_display, 132 133 108 'anonymize_ip' : anonymize_ip, 134 109 'woo_tracking' : woo_tracking, 135 110 'tracking_off_for_role' : tracking_off_for_role, 136 137 111 'tracking_off_for_this_role' : tracking_off_for_this_role 138 112 -
google-universal-analytics/trunk/classic/classic-analytics.php
r917494 r918587 1 1 <div class="wrap"> 2 3 2 <h2>Google Classic Analytics<em> (ga.js)</em></h2> 4 5 6 7 3 <br /> 8 9 <em>This is an older version of Google Analytics. Use this version only if you have not upgraded to Universal Analytics yet or want to use both trackers (which is totally fine!).</em> 10 4 <em>This is an older version of Google Analytics. Use this version only if you have not upgraded to Universal Analytics yet or want to use both trackers (which is totally fine!).</em> <br /> 11 5 <br /> 12 13 <br />14 15 6 <div class="col-lg-6 row"> 16 17 <form class="form-horizontal" role="form" id="classic-google-universal-options"> 18 19 20 21 <div class="form-group"> 22 23 <label for="web_property_id" class="col-sm-3 control-label">Status</label> 24 25 <div class="col-sm-9"> 26 27 <input id="classic_plugin_switch" type="checkbox" name="classic_plugin_switch" <?php if(get_option('classic_plugin_switch')=='on'): ?> checked="checked" <?php endif; ?>> 28 29 30 7 <form class="form-horizontal" method="post" action="options.php" role="form" id="classic-google-universal-options"> 8 <?php settings_fields('google-universal-settings-classic'); ?> 9 <div class="form-group"> 10 <label for="web_property_id" class="col-sm-3 control-label">Status</label> 11 <div class="col-sm-9"> 12 <input id="classic_plugin_switch" type="checkbox" name="classic_plugin_switch" <?php if(get_option('classic_plugin_switch')=='on'): ?> checked="checked" <?php endif; ?>> 13 </div> 14 </div> 15 <div class="form-group"> 16 <label for="classic_web_property_id" class="col-sm-3 control-label">Tracking ID</label> 17 <div class="col-sm-9"> 18 <input type="text" class="form-control" name="classic_web_property_id" id="classic_web_property_id" placeholder="Tracking code example: UA-23710779-7" value="<?php echo get_option('classic_property_id'); ?>"> 19 <span class="error hide"><strong>Error! </strong> match your code with this forma: UA-41335660-1</span> </div> 20 </div> 21 <div class="form-group"> 22 <div class="col-sm-offset-3 col-sm-9"> 23 <div class="checkbox"> 24 <label> 25 <input type="checkbox" name="classic_in_footer" id="classic_in_footer" <?php if(get_option('classic_in_footer')=='on'): ?> checked="checked" <?php endif; ?>> 26 Place code in footer </label> 31 27 </div> 32 33 28 </div> 34 35 <div class="form-group"> 36 37 <label for="classic_web_property_id" class="col-sm-3 control-label">Tracking ID</label> 38 39 <div class="col-sm-9"> 40 41 <input type="text" class="form-control" name="classic_web_property_id" id="classic_web_property_id" placeholder="Tracking code example: UA-23710779-7" value="<?php echo get_option('classic_property_id'); ?>"> 42 43 <span class="error hide"><strong>Error! </strong> match your code with this forma: UA-41335660-1</span> 44 45 </div> 46 47 </div> 48 49 50 51 52 53 <div class="form-group"> 54 55 <div class="col-sm-offset-3 col-sm-9"> 56 57 <div class="checkbox"> 58 59 <label> 60 61 <input type="checkbox" name="classic_in_footer" id="classic_in_footer" <?php if(get_option('classic_in_footer')=='on'): ?> checked="checked" <?php endif; ?>> 62 63 Place code in footer </label> 64 65 </div> 66 67 </div> 68 69 </div> 70 71 <div class="form-group"> 72 73 <div class="col-sm-offset-3 col-sm-9"> 74 29 </div> 30 <div class="form-group"> 31 <div class="col-sm-offset-3 col-sm-9"> 75 32 <?php global $wp_roles; 76 33 77 34 $roles = $wp_roles->get_names(); ?> 78 79 <div class="checkbox"> 80 81 <label> 82 83 <input type="checkbox" name="classic_tracking_off_for_role" id="classic_tracking_off_for_role" <?php if(get_option('classic_tracking_off_for_role')=='on'): ?> checked="checked" <?php endif; ?>> 84 85 Disable Tracking For <select id="classic_tracking_off_for_this_role"> 86 87 <?php foreach($roles as $role) { ?> 88 35 <div class="checkbox"> 36 <label> 37 <input type="checkbox" name="classic_tracking_off_for_role" id="classic_tracking_off_for_role" <?php if(get_option('classic_tracking_off_for_role')=='on'): ?> checked="checked" <?php endif; ?>> 38 Disable Tracking For 39 <select id="classic_tracking_off_for_this_role"> 40 <?php foreach($roles as $role) { ?> 89 41 <option value="<?php echo $role;?>" <?php if(get_option('classic_tracking_off_for_this_role')== $role){echo 'selected="selected"';} ?>><?php echo $role;?></option> 90 91 42 <?php } ?> 92 93 </select> </label> 94 95 </div> 96 43 </select> 44 </label> 97 45 </div> 98 99 46 </div> 100 101 <div class="form-group"> 102 103 <div class="col-sm-offset-3 col-sm-9"> 104 105 <input type="hidden" id="ajax_url" name="ajax_url" value="<?php echo admin_url('admin-ajax.php'); ?>" /> 106 107 <button type="button" class="btn btn-primary" id="save-classic-settings">Save Changes</button><span class="alert alert-success hide"><strong>Options Saved</strong></span> 108 109 </div> 110 111 </div> 112 113 </form> 114 47 </div> 48 <div class="form-group"> 49 <div class="col-sm-offset-3 col-sm-9"> 50 <input type="hidden" id="ajax_url" name="ajax_url" value="<?php echo admin_url('admin-ajax.php'); ?>" /> 51 <input type="submit" class="button-primary" value="<?php _e('Save Changes'); ?>" /> 52 <!--<button type="button" class="button button-primary" id="save-classic-settings">Save Changes</button>--> 53 <span class="alert alert-success hide"><strong>Options Saved</strong></span> </div> 54 </div> 55 </form> 115 56 </div> 116 117 57 <div class="clearfix"></div> 118 119 <div class="row col-lg-6">Have a question? Drop us a question at <a href="http://onlineads.lt/?utm_source=WordPress&utm_medium=Google%20Universal%20Analytics%202.2&utm_content=Google%20Classic%20Analytics&utm_campaign=WordPress%20plugins" title="Google Universal Analytics">OnlineAds.lt</a> </div> 120 58 <div class="row col-lg-6">Have a question? Drop us a question at <a href="http://onlineads.lt/?utm_source=WordPress&utm_medium=Google%20Universal%20Analytics%202.3.0.2&utm_content=Google%20Classic%20Analytics&utm_campaign=WordPress%20plugins" title="Google Universal Analytics">OnlineAds.lt</a> </div> 121 59 </div> 122 123 60 </br> 124 -
google-universal-analytics/trunk/classic/custom-analytics.php
r917494 r918587 1 1 <div class="wrap"> 2 3 2 <h2>Custom Google Analytics</h2> 4 5 6 7 3 <br /> 8 9 <em>This is a place to customize your tracking code. </em> 10 4 <em>This is a place to customize your tracking code. </em> <br /> 11 5 <br /> 12 13 <br />14 15 6 <div class="col-lg-6 row"> 16 17 <form class="form-horizontal" role="form" id="google-universal-options"> 18 19 20 21 <div class="form-group"> 22 23 <label for="web_property_id" class="col-sm-3 control-label">Status</label> 24 25 <div class="col-sm-9"> 26 27 <input id="custom_plugin_switch" type="checkbox" name="custom_plugin_switch" <?php if(get_option('custom_plugin_switch')=='on'): ?> checked="checked" <?php endif; ?>> 28 29 30 7 <form class="form-horizontal" method="post" action="options.php" role="form" id="google-universal-options"> 8 <?php settings_fields('google-universal-settings-custom'); ?> 9 <div class="form-group"> 10 <label for="web_property_id" class="col-sm-3 control-label">Status</label> 11 <div class="col-sm-9"> 12 <input id="custom_plugin_switch" type="checkbox" name="custom_plugin_switch" <?php if(get_option('custom_plugin_switch')=='on'): ?> checked="checked" <?php endif; ?>> 13 </div> 14 </div> 15 <div class="form-group"> 16 <label for="web_property_id" class="col-sm-3 control-label">Tracking Code</label> 17 <div class="col-sm-9"> 18 <textarea class="form-control" name="custom_web_property_id" id="custom_web_property_id" rows="6" placeholder="Past your custom google tracking code here"><?php echo get_option('custom_web_property_id'); ?></textarea> 19 </div> 20 </div> 21 <div class="form-group"> 22 <div class="col-sm-offset-3 col-sm-9"> 23 <div class="checkbox"> 24 <label> 25 <input type="checkbox" name="custom_in_footer" id="custom_in_footer" <?php if(get_option('custom_in_footer')=='on'): ?> checked="checked" <?php endif; ?>> 26 Place code in footer </label> 31 27 </div> 32 33 28 </div> 34 35 <div class="form-group"> 36 37 <label for="web_property_id" class="col-sm-3 control-label">Tracking Code</label> 38 39 <div class="col-sm-9"> 40 41 <textarea class="form-control" name="custom_web_property_id" id="custom_web_property_id" rows="6" placeholder="Past your custom google tracking code here"><?php echo get_option('custom_web_property_id'); ?></textarea> 42 43 44 45 </div> 46 47 </div> 48 49 50 51 <div class="form-group"> 52 53 <div class="col-sm-offset-3 col-sm-9"> 54 55 <div class="checkbox"> 56 57 <label> 58 59 <input type="checkbox" name="custom_in_footer" id="custom_in_footer" <?php if(get_option('custom_in_footer')=='on'): ?> checked="checked" <?php endif; ?>> 60 61 Place code in footer </label> 62 63 </div> 64 65 </div> 66 67 </div> 68 69 <div class="form-group"> 70 71 <div class="col-sm-offset-3 col-sm-9"> 72 29 </div> 30 <div class="form-group"> 31 <div class="col-sm-offset-3 col-sm-9"> 73 32 <?php global $wp_roles; 74 33 75 34 $roles = $wp_roles->get_names(); ?> 76 77 <div class="checkbox"> 78 79 <label> 80 81 <input type="checkbox" name="custom_tracking_off_for_role" id="custom_tracking_off_for_role" <?php if(get_option('custom_tracking_off_for_role')=='on'): ?> checked="checked" <?php endif; ?>> 82 83 Disable Tracking For <select id="custom_tracking_off_for_this_role"> 84 85 <?php foreach($roles as $role) { ?> 86 35 <div class="checkbox"> 36 <label> 37 <input type="checkbox" name="custom_tracking_off_for_role" id="custom_tracking_off_for_role" <?php if(get_option('custom_tracking_off_for_role')=='on'): ?> checked="checked" <?php endif; ?>> 38 Disable Tracking For 39 <select id="custom_tracking_off_for_this_role"> 40 <?php foreach($roles as $role) { ?> 87 41 <option value="<?php echo $role;?>" <?php if(get_option('custom_tracking_off_for_this_role')== $role){echo 'selected="selected"';} ?>><?php echo $role;?></option> 88 89 42 <?php } ?> 90 91 </select> </label> 92 93 </div> 94 43 </select> 44 </label> 95 45 </div> 96 97 46 </div> 98 99 100 101 <div class="form-group"> 102 103 <div class="col-sm-offset-3 col-sm-9"> 104 105 <input type="hidden" id="ajax_url" name="ajax_url" value="<?php echo admin_url('admin-ajax.php'); ?>" /> 106 107 <button type="button" class="btn btn-primary" id="save-custom-settings">Save Changes</button><span class="alert alert-success hide"><strong>Options Saved</strong></span> 108 109 </div> 110 111 </div> 112 113 </form> 114 47 </div> 48 <div class="form-group"> 49 <div class="col-sm-offset-3 col-sm-9"> 50 <input type="hidden" id="ajax_url" name="ajax_url" value="<?php echo admin_url('admin-ajax.php'); ?>" /> 51 <input type="submit" class="button-primary" value="<?php _e('Save Changes'); ?>" /> 52 <!--<button type="button" class="button button-primary" id="save-custom-settings">Save Changes</button>--> 53 <span class="alert alert-success hide"><strong>Options Saved</strong></span> </div> 54 </div> 55 </form> 115 56 </div> 116 117 57 <div class="clearfix"></div> 118 119 <div class="row col-lg-6">Have a question? Drop us a question at <a href="http://onlineads.lt/?utm_source=WordPress&utm_medium=Google%20Universal%20Analytics%202.2&utm_content=Google%20Custom%20Analytics&utm_campaign=WordPress%20plugins">OnlineAds.lt</a> </div> 120 58 <div class="row col-lg-6">Have a question? Drop us a question at <a href="http://onlineads.lt/?utm_source=WordPress&utm_medium=Google%20Universal%20Analytics%202.3.0.2&utm_content=Google%20Custom%20Analytics&utm_campaign=WordPress%20plugins">OnlineAds.lt</a> </div> 121 59 </div> 122 123 60 </br> 124 -
google-universal-analytics/trunk/googleanalytics.php
r917494 r918587 4 4 5 5 Plugin Name: Google Universal Analytics 6 7 6 Plugin URI: http://wordpress.org/extend/plugins/google-universal-analytics/ 8 9 7 Description: Adds <a href="http://www.google.com/analytics/">Google Analytics</a> tracking code on all pages. 10 11 Version: 2.2 12 8 Version: 2.3.0.2 13 9 Author: Audrius Dobilinskas 14 15 10 Author URI: http://onlineads.lt/ 16 11 17 12 */ 18 13 19 20 21 14 if (!defined('WP_CONTENT_URL')) 22 15 … … 36 29 37 30 38 31 register_deactivation_hook(__FILE__, 'deactive_google_universal_analytics'); 32 register_activation_hook( __FILE__, 'activate_google_universal_analytics' ); 33 add_action( 'admin_init', 'register_plugin_settings' ); 34 add_action( 'admin_init', 'register_plugin_settings1' ); 35 add_action( 'admin_init', 'register_plugin_settings2' ); 36 function register_plugin_settings(){ 37 38 register_setting('google-universal-settings','plugin_switch'); 39 register_setting('google-universal-settings','web_property_id'); 40 register_setting('google-universal-settings','in_footer'); 41 register_setting('google-universal-settings','track_links'); 42 register_setting('google-universal-settings','enable_display'); 43 register_setting('google-universal-settings','anonymize_ip'); 44 register_setting('google-universal-settings','woo_tracking'); 45 register_setting('google-universal-settings','tracking_off_for_this_role'); 46 register_setting('google-universal-settings','tracking_off_for_role'); 47 48 49 } 50 function register_plugin_settings1(){ 51 //classic_options 52 register_setting('google-universal-settings-classic','classic_property_id'); 53 register_setting('google-universal-settings-classic','classic_in_footer'); 54 register_setting('google-universal-settings-classic','classic_plugin_switch'); 55 register_setting('google-universal-settings-classic','classic_tracking_off_for_role'); 56 register_setting('google-universal-settings-classic','classic_tracking_off_for_this_role'); 57 } 58 function register_plugin_settings2(){ 59 //custom_options 60 register_setting('google-universal-settings-custom','custom_in_footer'); 61 register_setting('google-universal-settings-custom','custom_plugin_switch'); 62 register_setting('google-universal-settings-custom','custom_web_property_id'); 63 register_setting('google-universal-settings-custom','custom_tracking_off_for_role'); 64 register_setting('google-universal-settings-custom','custom_tracking_off_for_this_role'); 65 } 66 function activate_google_universal_analytics(){ 67 68 69 70 71 $woo_code_path = get_template_directory().'/woo_code.php'; 72 if(!file_exists($woo_code_path)){ 73 copy(plugin_dir_path( __FILE__ ).'woo_code.php', $woo_code_path); 74 } 75 } 39 76 function deactive_google_universal_analytics() { 40 41 77 delete_option('web_property_id'); 42 43 78 delete_option('in_footer'); 44 45 79 delete_option('plugin_switch'); 46 47 80 delete_option('track_links'); 81 delete_option('enable_display'); 82 delete_option('anonymize_ip'); 83 delete_option('woo_tracking'); 84 delete_option('tracking_off_for_this_role'); 85 delete_option('tracking_off_for_role'); 86 87 //classic_options 88 delete_option('classic_property_id'); 89 delete_option('classic_in_footer'); 90 delete_option('classic_plugin_switch'); 91 delete_option('classic_tracking_off_for_role'); 92 delete_option('classic_tracking_off_for_this_role'); 93 48 94 49 delete_option('enable_display'); 95 96 //custom_options 97 98 delete_option('custom_in_footer'); 99 delete_option('custom_plugin_switch'); 100 delete_option('custom_web_property_id'); 101 delete_option('custom_tracking_off_for_role'); 102 delete_option('custom_tracking_off_for_this_role'); 103 104 //delete woo code file 105 $woo_code_path = get_template_directory().'/woo_code.php'; 106 if(file_exists($woo_code_path)){ 107 unlink($woo_code_path); 108 } 109 $var1 = 'require "woo_code.php";'; 110 $get_func_file_path = get_template_directory().'/functions.php'; 111 $contents = file_get_contents($get_func_file_path); 112 $contents = str_replace($var1, '', $contents); 113 file_put_contents($get_func_file_path, $contents); 114 } 115 116 117 118 119 120 function admin_menu_google_universal_analytics() { 121 122 global $settings_page, $settings_page1, $classic_page, $cutom_page; 123 50 124 51 delete_option('anonymize_ip'); 52 53 delete_option('tracking_off_for_this_role'); 54 55 delete_option('tracking_off_for_role'); 56 57 //classic_options 58 59 delete_option('classic_property_id'); 60 61 delete_option('classic_in_footer'); 62 63 delete_option('classic_plugin_switch'); 64 65 delete_option('classic_tracking_off_for_role'); 66 67 delete_option('classic_tracking_off_for_this_role'); 125 126 $settings_page = add_menu_page( 'Google Universal Analytics', 'Google Universal Analytics', 'manage_options', 'google_universal_analytics', 'options_page_google_universal_analytics' ); 127 128 add_submenu_page('google_universal_analytics','','','manage_options','google_universal_analytics','options_page_google_universal_analytics'); 129 130 $settings_page1 = add_submenu_page( 'google_universal_analytics', 'Universal Analytics', 'Universal Analytics', 'manage_options', 'google_universal_analytics', 'options_page_google_universal_analytics' ); 131 132 $classic_page = add_submenu_page( 'google_universal_analytics', 'Classic Analytics', 'Classic Analytics', 'manage_options', 'classic_analytics', 'classic_analytics_page_google_universal_analytics' ); 133 134 135 136 $cutom_page = add_submenu_page( 'google_universal_analytics', 'Custom Tracker', 'Custom Tracker', 'manage_options', 'custom_analytics', 'custom_analytics_page_google_universal_analytics' ); 68 137 69 138 70 139 71 //custom_options72 73 delete_option('custom_in_footer');74 75 delete_option('custom_plugin_switch');76 77 delete_option('custom_web_property_id');78 79 delete_option('custom_tracking_off_for_role');80 81 delete_option('custom_tracking_off_for_this_role');82 83 }84 85 86 87 88 89 function admin_menu_google_universal_analytics() {90 91 92 93 94 95 global $settings_page, $settings_page1, $classic_page, $cutom_page;96 97 98 99 $settings_page = add_menu_page( 'Google Universal Analytics', 'Google Universal Analytics', 'manage_options', 'google_universal_analytics', 'options_page_google_universal_analytics' );100 101 add_submenu_page('google_universal_analytics','','','manage_options','google_universal_analytics','options_page_google_universal_analytics');102 103 $settings_page1 = add_submenu_page( 'google_universal_analytics', 'Universal Analytics', 'Universal Analytics', 'manage_options', 'google_universal_analytics', 'options_page_google_universal_analytics' );104 105 $classic_page = add_submenu_page( 'google_universal_analytics', 'Classic Analytics', 'Classic Analytics', 'manage_options', 'classic_analytics', 'classic_analytics_page_google_universal_analytics' );106 107 108 109 $cutom_page = add_submenu_page( 'google_universal_analytics', 'Custom Tracker', 'Custom Tracker', 'manage_options', 'custom_analytics', 'custom_analytics_page_google_universal_analytics' );110 111 112 113 140 } 114 141 … … 149 176 $classic_analytics_code = "<script type='text/javascript'> 150 177 151 152 153 178 var _gaq = _gaq || []; 154 155 179 _gaq.push(['_setAccount', '$classic_property_id']); 156 157 180 _gaq.push(['_trackPageview']); 158 181 159 160 161 182 (function() { 162 163 183 var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; 164 165 184 ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; 166 167 185 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); 168 169 186 })(); 170 187 171 172 173 188 </script>"; 174 189 … … 210 225 211 226 wp_register_script( 'google-js', '//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js', array(), '', true ); 212 213 wp_register_script( 'bootstrap-js', plugins_url( 'google-universal-analytics/bootstrap/js/bootstrap.min.js' , dirname(__FILE__) ), array('google-js'), '', true ); 214 215 wp_register_script( 'bootstrap-switch-js', plugins_url( 'google-universal-analytics/bootstrap/js/bootstrap-switch.min.js' , dirname(__FILE__) ) , array('bootstrap-js'),'',true ); 216 227 wp_register_script( 'bootstrap-switch-js', plugins_url( 'google-universal-analytics/bootstrap/js/bootstrap-switch.min.js' , dirname(__FILE__) ) , array('google-js'),'',true ); 217 228 wp_register_script( 'main-js', plugins_url( 'google-universal-analytics/assets/gua-main.js' , dirname(__FILE__) ) , array('google-js'),'',true ); 218 229 … … 223 234 //enqueue styles 224 235 225 wp_enqueue_style( 'bootstrap-css' ); 226 236 //wp_enqueue_style( 'bootstrap-css' ); 227 237 wp_enqueue_style( 'bootstrap-switch-css' ); 228 229 238 wp_enqueue_style( 'main-css' ); 230 239 … … 234 243 235 244 wp_enqueue_script( 'google-js' ); 236 237 wp_enqueue_script( 'bootstrap-js' ); 238 245 //wp_enqueue_script( 'bootstrap-js' ); 239 246 wp_enqueue_script( 'bootstrap-switch-js' ); 240 241 247 wp_enqueue_script( 'main-js' ); 242 248 … … 247 253 248 254 249 register_deactivation_hook(__FILE__, 'deactive_google_universal_analytics'); 255 250 256 251 257 … … 450 456 451 457 function save_google_universal_analytics_settings() { 452 453 458 // The $_REQUEST contains all the data sent via ajax 454 455 459 if ( isset($_REQUEST) ) { 456 457 460 $property_id = $_REQUEST['property_id']; 458 459 461 $in_footer = $_REQUEST['in_footer']; 460 461 462 $plugin_switch = $_REQUEST['plugin_switch']; 462 463 463 $track_links = $_REQUEST['track_links']; 464 465 464 $enable_display = $_REQUEST['enable_display']; 466 467 465 $anonymize_ip = $_REQUEST['anonymize_ip']; 468 466 $woo_tracking = $_REQUEST['woo_tracking']; 469 467 $tracking_off_for_this_role = $_REQUEST['tracking_off_for_this_role']; 470 471 468 $tracking_off_for_role = $_REQUEST['tracking_off_for_role']; 472 469 … … 476 473 477 474 update_option('web_property_id', $property_id); 478 479 475 update_option('in_footer', $in_footer); 480 481 476 update_option('plugin_switch', $plugin_switch); 482 483 477 update_option('track_links', $track_links); 484 485 478 update_option('enable_display', $enable_display); 486 487 479 update_option('anonymize_ip', $anonymize_ip); 488 480 update_option('woo_tracking', $woo_tracking); 489 481 update_option('tracking_off_for_this_role', $tracking_off_for_this_role); 490 491 482 update_option('tracking_off_for_role', $tracking_off_for_role); 492 483 … … 508 499 509 500 $classic_property_id = $_REQUEST['classic_property_id']; 510 511 501 $classic_in_footer = $_REQUEST['classic_in_footer']; 512 513 502 $classic_plugin_switch = $_REQUEST['classic_plugin_switch']; 514 515 503 $classic_tracking_off_for_role = $_REQUEST['classic_tracking_off_for_role']; 516 517 504 $classic_tracking_off_for_this_role = $_REQUEST['classic_tracking_off_for_this_role']; 518 505 … … 584 571 585 572 add_action( 'wp_ajax_save_google_universal_analytics_settings', 'save_google_universal_analytics_settings' ); 586 587 573 add_action( 'wp_ajax_save_google_classic_analytics_settings', 'save_google_classic_analytics_settings' ); 588 589 574 add_action( 'wp_ajax_save_google_custom_analytics_settings', 'save_google_custom_analytics_settings' ); 590 575 591 576 592 577 593 594 595 ?> 578 //adding woo tracking 579 580 $var1 = 'require "woo_code.php";'; 581 $get_func_file_path = get_template_directory().'/functions.php'; 582 if(get_option('woo_tracking')=='on'){ 583 if(strpos(file_get_contents($get_func_file_path),$var1) !== false){ 584 }else{ 585 $data = sprintf("%s\n", $var1); 586 file_put_contents($get_func_file_path, $data, FILE_APPEND); 587 } 588 }elseif(get_option('woo_tracking')=='off'){ 589 $contents = file_get_contents($get_func_file_path); 590 $contents = str_replace($var1, '', $contents); 591 file_put_contents($get_func_file_path, $contents); 592 } 593 -
google-universal-analytics/trunk/options.php
r917494 r918587 3 3 <br /> 4 4 <div class="col-lg-6 row"> 5 <form class="form-horizontal" role="form" id="google-universal-options"> 5 <form class="form-horizontal" method="post" action="options.php" role="form"> 6 <?php settings_fields('google-universal-settings'); ?> 6 7 <div class="form-group"> 7 8 <label for="web_property_id" class="col-sm-3 control-label">Status</label> … … 58 59 <div class="form-group"> 59 60 <div class="col-sm-offset-3 col-sm-9"> 61 <div class="checkbox"> 62 <label> 63 <input type="checkbox" name="woo_tracking" id="woo_tracking" <?php if(get_option('woo_tracking')=='on'): ?> checked="checked" <?php endif; ?>> 64 Enable Woocommerce e-commerce tracking <span style="color:green;">New!</span> </label> 65 </div> 66 </div> 67 </div> 68 <div class="form-group"> 69 <div class="col-sm-offset-3 col-sm-9"> 60 70 <?php global $wp_roles; 61 71 … … 77 87 <div class="col-sm-offset-3 col-sm-9"> 78 88 <input type="hidden" id="ajax_url" name="ajax_url" value="<?php echo admin_url('admin-ajax.php'); ?>" /> 79 <button type="button" class="btn btn-primary" id="save-gua-settings">Save Changes</button> 89 <input type="submit" class="button-primary" value="<?php _e('Save Changes'); ?>" /> 90 <!--<button type="button" class="button button-primary" id="save-gua-settings">Save Changes</button>--> 80 91 <span class="alert alert-success hide"><strong>Options Saved</strong></span> </div> 81 92 </div> … … 83 94 </div> 84 95 <div class="clearfix"></div> 85 <div class="row col-lg-6">Have a question? Drop us a question at <a href="http://onlineads.lt/?utm_source=WordPress&utm_medium=Google%20Universal%20Analytics%202. 2&utm_content=Google%20Universal%20Analytics&utm_campaign=WordPress%20plugins" title="Google Universal Analytics">OnlineAds.lt</a> </div>96 <div class="row col-lg-6">Have a question? Drop us a question at <a href="http://onlineads.lt/?utm_source=WordPress&utm_medium=Google%20Universal%20Analytics%202.3.0.2&utm_content=Google%20Universal%20Analytics&utm_campaign=WordPress%20plugins" title="Google Universal Analytics">OnlineAds.lt</a> </div> 86 97 </div> 87 98 </br> -
google-universal-analytics/trunk/readme.txt
r917494 r918587 2 2 Contributors: audriusd 3 3 Donate link: http://onlineads.lt/ 4 Tags: javascript, tracking, google, analytics, universal, statistics, google analytics, universal analytics, google universal analytics, classic, custom 4 Tags: javascript, tracking, google, analytics, universal, statistics, google analytics, universal analytics, google universal analytics, classic, custom, woocommerce, ecommerce 5 5 Requires at least: 3.0 6 6 Tested up to: 3.9.1 7 Stable tag: 2.3.0. 17 Stable tag: 2.3.0.2 8 8 License: GPLv2 or later 9 9 10 Adds the latest Google Universal Analytics JavaScript tracking code to your WordPress website. 10 Adds the latest Google Universal Analytics JavaScript tracking code to your WordPress website. Now supports WooCommerce! 11 11 12 12 == Description == … … 63 63 == Changelog == 64 64 65 = 2.3.0.1 = 66 * Reverting back to previous working version as users experience issues with WooCommerce tracking 65 = 2.3.0.2 = 66 * Bug fixed: Save settings issue 67 * Big fixed: WooCommerce issue 68 69 = 2.3 = 70 * WooCommerce e-commerce tracking added (beta). 67 71 68 72 = 2.2 = … … 104 108 == Upgrade Notice == 105 109 106 = 2.3.0. 1=107 * Reverting back to previous working version as users experience issues withWooCommerce tracking110 = 2.3.0.2 = 111 * Bugs fixed: Save settings issue and WooCommerce tracking 108 112 109 113 = 2.2 = -
google-universal-analytics/trunk/tracking-code.php
r917494 r918587 24 24 25 25 (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ 26 27 26 (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), 28 29 27 m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) 30 31 28 })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); 32 33 34 29 35 30 ga('create', '<?php echo $web_property_id; ?>', '<?php echo $homeurl; ?>');
Note: See TracChangeset
for help on using the changeset viewer.