Plugin Directory

Changeset 918587


Ignore:
Timestamp:
05/21/2014 10:13:31 AM (12 years ago)
Author:
audriusd
Message:

Google Universal Analytics 2.3.0.2

Location:
google-universal-analytics
Files:
25 added
8 edited

Legend:

Unmodified
Added
Removed
  • google-universal-analytics/trunk/assets/gua-main.css

    r868884 r918587  
    55
    66
     7.form-horizontal{
     8    font-size:14px;
     9}
    710.form-horizontal .alert{
    8 
    911    margin-left:10px;
    10 
    11     padding:8px;   
    12 
     12    padding:8px;
     13       
    1314}
     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  
    11jQuery(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});*/
    310   
    411
    512    jQuery('#classic_plugin_switch').bootstrapSwitch('size', 'small');
    6 
    713    jQuery('#classic_plugin_switch').bootstrapSwitch('onColor', 'success');
    8 
    914    jQuery('#classic_plugin_switch').bootstrapSwitch('offColor', 'danger');
    1015
     
    1217
    1318    jQuery('#plugin_switch').bootstrapSwitch('size', 'small');
    14 
    1519    jQuery('#plugin_switch').bootstrapSwitch('onColor', 'success');
    16 
    1720    jQuery('#plugin_switch').bootstrapSwitch('offColor', 'danger');
    1821
     
    2023
    2124    jQuery('#custom_plugin_switch').bootstrapSwitch('size', 'small');
    22 
    2325    jQuery('#custom_plugin_switch').bootstrapSwitch('onColor', 'success');
    24 
    2526    jQuery('#custom_plugin_switch').bootstrapSwitch('offColor', 'danger');
    2627
     
    2829
    2930    jQuery(function() {
    30 
    3131    jQuery('#save-gua-settings').click(function(e) {
    32 
    3332            var property_id =   jQuery('#web_property_id').val();
    34 
    3533            var tracking_off_for_this_role  =   jQuery('#tracking_off_for_this_role').val();
    36 
    3734            var ajax_url                      = jQuery('#ajax_url').val();
    38 
    3935            if(jQuery('#in_footer').is(':checked')){
    40 
    4136                var in_footer   =   'on';   
    42 
    43             }else{
    44 
     37            }else{
    4538                var in_footer   =   'off';
    46 
    4739            }
    4840
     
    5042
    5143            if(jQuery('#plugin_switch').is(':checked')){
    52 
    5344                var plugin_switch   =   'on';   
    54 
    55             }else{
    56 
     45            }else{
    5746                var plugin_switch   =   'off';
    58 
    5947            }
    6048
     
    6250
    6351            if(jQuery('#track_links').is(':checked')){
    64 
    6552                var track_links =   'on';   
    66 
    67             }else{
    68 
     53            }else{
    6954                var track_links =   'off';
    70 
    7155            }
    7256           
    7357            if(jQuery('#enable_display').is(':checked')){
    74 
    7558                var enable_display  =   'on';   
    76 
    77             }else{
    78 
     59            }else{
    7960                var enable_display  =   'off';
    80 
    8161            }
    8262           
    8363            if(jQuery('#anonymize_ip').is(':checked')){
    84 
    8564                var anonymize_ip    =   'on';   
    86 
    87             }else{
    88 
     65            }else{
    8966                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';
    9172            }
    9273
    9374            if(jQuery('#tracking_off_for_role').is(':checked')){
    94 
    9575                var tracking_off_for_role   =   'on';   
    9676
     
    122102
    123103                            'plugin_switch' : plugin_switch,
    124 
    125104                            'in_footer' : in_footer,
    126 
    127105                            'property_id' : property_id,
    128 
    129106                            'track_links' : track_links,
    130                            
    131107                            'enable_display' : enable_display,
    132                            
    133108                            'anonymize_ip' : anonymize_ip,
    134 
     109                            'woo_tracking' : woo_tracking,
    135110                            'tracking_off_for_role'       : tracking_off_for_role,
    136 
    137111                            'tracking_off_for_this_role' : tracking_off_for_this_role
    138112
  • google-universal-analytics/trunk/classic/classic-analytics.php

    r917494 r918587  
    11<div class="wrap">
    2 
    32  <h2>Google Classic Analytics<em> (ga.js)</em></h2>
    4 
    5  
    6 
    73  <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 />
    115  <br />
    12 
    13   <br />
    14 
    156  <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>
    3127          </div>
    32 
    3328        </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">
    7532          <?php global $wp_roles;
    7633
    7734     $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) { ?>
    8941                <option value="<?php echo $role;?>" <?php if(get_option('classic_tracking_off_for_this_role')== $role){echo 'selected="selected"';} ?>><?php echo $role;?></option>
    90 
    9142                <?php } ?>
    92 
    93                </select> </label>
    94 
    95             </div>
    96 
     43              </select>
     44            </label>
    9745          </div>
    98 
    9946        </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>
    11556  </div>
    116 
    11757  <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>
    12159</div>
    122 
    12360</br>
    124 
  • google-universal-analytics/trunk/classic/custom-analytics.php

    r917494 r918587  
    11<div class="wrap">
    2 
    32  <h2>Custom Google Analytics</h2>
    4 
    5  
    6 
    73  <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 />
    115  <br />
    12 
    13   <br />
    14 
    156  <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>
    3127          </div>
    32 
    3328        </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">
    7332          <?php global $wp_roles;
    7433
    7534     $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) { ?>
    8741                <option value="<?php echo $role;?>" <?php if(get_option('custom_tracking_off_for_this_role')== $role){echo 'selected="selected"';} ?>><?php echo $role;?></option>
    88 
    8942                <?php } ?>
    90 
    91                </select> </label>
    92 
    93             </div>
    94 
     43              </select>
     44            </label>
    9545          </div>
    96 
    9746        </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>
    11556  </div>
    116 
    11757  <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>
    12159</div>
    122 
    12360</br>
    124 
  • google-universal-analytics/trunk/googleanalytics.php

    r917494 r918587  
    44
    55Plugin Name: Google Universal Analytics
    6 
    76Plugin URI: http://wordpress.org/extend/plugins/google-universal-analytics/
    8 
    97Description: Adds <a href="http://www.google.com/analytics/">Google Analytics</a> tracking code on all pages.
    10 
    11 Version: 2.2
    12 
     8Version: 2.3.0.2
    139Author: Audrius Dobilinskas
    14 
    1510Author URI: http://onlineads.lt/
    1611
    1712*/
    1813
    19 
    20 
    2114if (!defined('WP_CONTENT_URL'))
    2215
     
    3629
    3730
    38 
     31register_deactivation_hook(__FILE__, 'deactive_google_universal_analytics');
     32register_activation_hook( __FILE__, 'activate_google_universal_analytics' );
     33add_action( 'admin_init', 'register_plugin_settings' );
     34add_action( 'admin_init', 'register_plugin_settings1' );
     35add_action( 'admin_init', 'register_plugin_settings2' );
     36function 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}
     50function 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}
     58function 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}
     66function 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}
    3976function deactive_google_universal_analytics() {
    40 
    4177  delete_option('web_property_id');
    42 
    4378  delete_option('in_footer');
    44 
    4579  delete_option('plugin_switch');
    46 
    4780  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
    4894 
    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
     120function admin_menu_google_universal_analytics() {
     121
     122  global  $settings_page, $settings_page1, $classic_page, $cutom_page;
     123
    50124 
    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' );
    68137
    69138 
    70139
    71   //custom_options
    72 
    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 
    113140}
    114141
     
    149176  $classic_analytics_code   =   "<script type='text/javascript'>
    150177
    151 
    152 
    153178  var _gaq = _gaq || [];
    154 
    155179  _gaq.push(['_setAccount', '$classic_property_id']);
    156 
    157180  _gaq.push(['_trackPageview']);
    158181
    159 
    160 
    161182  (function() {
    162 
    163183    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    164 
    165184    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    166 
    167185    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    168 
    169186  })();
    170187
    171 
    172 
    173188</script>";
    174189
     
    210225
    211226        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 );
    217228        wp_register_script( 'main-js', plugins_url( 'google-universal-analytics/assets/gua-main.js' , dirname(__FILE__) ) , array('google-js'),'',true );
    218229
     
    223234        //enqueue styles
    224235
    225         wp_enqueue_style( 'bootstrap-css' );
    226 
     236        //wp_enqueue_style( 'bootstrap-css' );
    227237        wp_enqueue_style( 'bootstrap-switch-css' );
    228 
    229238        wp_enqueue_style( 'main-css' );
    230239
     
    234243
    235244        wp_enqueue_script( 'google-js' );
    236 
    237         wp_enqueue_script( 'bootstrap-js' );
    238 
     245        //wp_enqueue_script( 'bootstrap-js' );
    239246        wp_enqueue_script( 'bootstrap-switch-js' );
    240 
    241247        wp_enqueue_script( 'main-js' );
    242248
     
    247253
    248254
    249 register_deactivation_hook(__FILE__, 'deactive_google_universal_analytics');
     255
    250256
    251257
     
    450456
    451457function save_google_universal_analytics_settings() {
    452 
    453458    // The $_REQUEST contains all the data sent via ajax
    454 
    455459    if ( isset($_REQUEST) ) {
    456 
    457460        $property_id = $_REQUEST['property_id'];
    458 
    459461        $in_footer = $_REQUEST['in_footer'];
    460 
    461462        $plugin_switch = $_REQUEST['plugin_switch'];
    462 
    463463        $track_links = $_REQUEST['track_links'];
    464        
    465464        $enable_display = $_REQUEST['enable_display'];
    466        
    467465        $anonymize_ip = $_REQUEST['anonymize_ip'];
    468 
     466        $woo_tracking = $_REQUEST['woo_tracking'];
    469467        $tracking_off_for_this_role = $_REQUEST['tracking_off_for_this_role'];
    470 
    471468        $tracking_off_for_role = $_REQUEST['tracking_off_for_role'];
    472469
     
    476473
    477474        update_option('web_property_id', $property_id);
    478 
    479475        update_option('in_footer', $in_footer);
    480 
    481476        update_option('plugin_switch', $plugin_switch);
    482 
    483477        update_option('track_links', $track_links);
    484        
    485478        update_option('enable_display', $enable_display);
    486        
    487479        update_option('anonymize_ip', $anonymize_ip);
    488 
     480        update_option('woo_tracking', $woo_tracking);
    489481        update_option('tracking_off_for_this_role', $tracking_off_for_this_role);
    490 
    491482        update_option('tracking_off_for_role', $tracking_off_for_role);
    492483
     
    508499
    509500        $classic_property_id = $_REQUEST['classic_property_id'];
    510 
    511501        $classic_in_footer = $_REQUEST['classic_in_footer'];
    512 
    513502        $classic_plugin_switch = $_REQUEST['classic_plugin_switch'];
    514 
    515503        $classic_tracking_off_for_role = $_REQUEST['classic_tracking_off_for_role'];
    516 
    517504        $classic_tracking_off_for_this_role = $_REQUEST['classic_tracking_off_for_this_role'];
    518505
     
    584571
    585572add_action( 'wp_ajax_save_google_universal_analytics_settings', 'save_google_universal_analytics_settings' );
    586 
    587573add_action( 'wp_ajax_save_google_classic_analytics_settings', 'save_google_classic_analytics_settings' );
    588 
    589574add_action( 'wp_ajax_save_google_custom_analytics_settings', 'save_google_custom_analytics_settings' );
    590575
    591576
    592577
    593 
    594 
    595 ?>
     578//adding woo tracking
     579
     580$var1   =   'require "woo_code.php";';
     581$get_func_file_path =   get_template_directory().'/functions.php';
     582if(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  
    33  <br />
    44  <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'); ?>
    67      <div class="form-group">
    78        <label for="web_property_id" class="col-sm-3 control-label">Status</label>
     
    5859      <div class="form-group">
    5960        <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">
    6070          <?php global $wp_roles;
    6171
     
    7787        <div class="col-sm-offset-3 col-sm-9">
    7888          <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>-->
    8091          <span class="alert alert-success hide"><strong>Options Saved</strong></span> </div>
    8192      </div>
     
    8394  </div>
    8495  <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>
    8697</div>
    8798</br>
  • google-universal-analytics/trunk/readme.txt

    r917494 r918587  
    22Contributors: audriusd
    33Donate link: http://onlineads.lt/
    4 Tags: javascript, tracking, google, analytics, universal, statistics, google analytics, universal analytics, google universal analytics, classic, custom
     4Tags: javascript, tracking, google, analytics, universal, statistics, google analytics, universal analytics, google universal analytics, classic, custom, woocommerce, ecommerce
    55Requires at least: 3.0
    66Tested up to: 3.9.1
    7 Stable tag: 2.3.0.1
     7Stable tag: 2.3.0.2
    88License: GPLv2 or later
    99
    10 Adds the latest Google Universal Analytics JavaScript tracking code to your WordPress website.
     10Adds the latest Google Universal Analytics JavaScript tracking code to your WordPress website. Now supports WooCommerce!
    1111
    1212== Description ==
     
    6363== Changelog ==
    6464
    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).
    6771
    6872= 2.2 =
     
    104108== Upgrade Notice ==
    105109
    106 = 2.3.0.1 =
    107 * Reverting back to previous working version as users experience issues with WooCommerce tracking
     110= 2.3.0.2 =
     111* Bugs fixed: Save settings issue and WooCommerce tracking
    108112
    109113= 2.2 =
  • google-universal-analytics/trunk/tracking-code.php

    r917494 r918587  
    2424
    2525(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    26 
    2726(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
    28 
    2927m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    30 
    3128})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
    32 
    33 
    3429
    3530ga('create', '<?php echo $web_property_id; ?>', '<?php echo $homeurl; ?>');
Note: See TracChangeset for help on using the changeset viewer.