Plugin Directory

Changeset 639533


Ignore:
Timestamp:
12/15/2012 02:28:08 AM (13 years ago)
Author:
ethoseo
Message:

New Version: 1.1.0

Location:
track-everything/trunk
Files:
8 added
4 edited

Legend:

Unmodified
Added
Removed
  • track-everything/trunk/css/admin.css

    r625290 r639533  
    66#special-tracking .event label {display:inline-block;width:49%}
    77.spread_the_word ul {list-style:square; margin-left:25px}
     8.track-everything_page_track-everything-help .tewrap {max-width: 600px;margin:25px 0 0 50px}
     9.track-everything_page_track-everything-help .tewrap table {border: 1px solid #c4c4c4;border-collapse: collapse;font-size: 14px;line-height: 1.3}
     10.track-everything_page_track-everything-help .tewrap table td {border: 1px solid #c4c4c4;padding: 3px 5px}
     11.track-everything_page_track-everything-help .tewrap table th {border: 1px solid #c4c4c4;padding: 3px;background-color:#c4c4c4}
  • track-everything/trunk/index.php

    r636885 r639533  
    55Description: A plugin capable of adding Google Analytics Event Tracking to <em>everything</em> on a website.
    66Author: Ethoseo Internet Marketing
    7 Version: 1.0.2
     7Version: 1.1.0
    88Author URI: http://www.ethoseo.com/
    99License: MIT License
     
    2020
    2121$ethoseo_te_version = "1.0";
     22define( 'ETHOSEO_TE_PATH', plugin_dir_path(__FILE__) );
     23define( 'ETHOSEO_TE_FILE', __FILE__);
    2224
    2325function ethoseo_te_enqueue() {
     
    101103    $ethoseo_te_special_page = add_submenu_page('track-everything', 'Track Everything > Specific Tracking', 'Specific Events', 'activate_plugins', 'track-everything/specific', 'ethoseo_te_special_page');
    102104    $ethoseo_te_dictionary_page = add_submenu_page('track-everything', 'Track Everything > Labels', 'Tracking Labels', 'activate_plugins', 'track-everything/labels', 'ethoseo_te_dictionary_page');
     105    $ethoseo_te_help_page = add_submenu_page('track-everything', 'Track Everything > Help', 'Help', 'activate_plugins', 'track-everything/help', 'ethoseo_te_help_page');
    103106}
    104107
     
    116119}
    117120
    118 function ethoseo_te_settings_page() {
     121function ethoseo_te_page ($pagename){
    119122
    120123    if (!current_user_can('activate_plugins'))  {
    121124        wp_die( __('You do not have sufficient permissions to access this page.') );
    122125    }
     126
    123127    global $wpdb;
    124128
    125     ?>
    126 <div class="wrap">
    127 <!--
    128 Hi There <?php
    129 global $current_user;
    130 echo $current_user->display_name;
    131 ?>!
    132 You're reading the code, that means I think you're pretty awesome. <?php /* Especially if you're reading the PHP code. */ ?>
    133 This plugin uses the Google Analytics async API to track _everything_.
    134 If you have a better way of doing this or anything else, or want to talk WordPress, PHP, internet marketing, or similarly nerdy things drop me an email: <nick@ethoseo.com>.
    135 Enjoy The Plugin!
    136 --
    137 Nick of Ethoseo Internet Marketing
    138 -->
    139     <div id="icon-track-everything" class="icon32"><br /></div><h2>Track Everything</h2>
    140     <?php
    141         if($_POST['submit'] == "Save Changes"){
    142             update_option("ethoseo_te_trackforms", $_POST['trackforms']);
    143             update_option("ethoseo_te_trackoutbound", $_POST['trackoutbound']);
    144             update_option("ethoseo_te_tracksearchforms", $_POST['tracksearchforms']);
    145             update_option("ethoseo_te_trackemail", $_POST['trackemail']);
    146 
    147             update_option("ethoseo_te_infooter", $_POST['infooter']);
    148             update_option("ethoseo_te_debug", $_POST['debug']);
    149 
    150             echo '<div id="setting-error-settings_updated" class="updated settings-error"><p><strong>Settings saved.</strong></p></div>';
    151         }
    152     ?>
    153     <?php include "ethoseo.php"; ?>
    154     <form method="POST">
    155         <h3>General Tracking</h3>
    156         <p>By default Track Eveything tracks <em>everything</em>. You can toggle this default functionality.</p>
    157         <table class="form-table" style="clear: left; width: auto;">
    158             <tr valign="top">
    159                 <th scope="row"><label for="trackforms">Track Form Submissions</label></th>
    160                 <td>
    161                     <input name="trackforms" type="checkbox" id="trackforms" value="true" <?php echo get_option("ethoseo_te_trackforms") ? 'checked="checked"' : ""; ?>/>
    162                     <span class="description">This will trigger an Event any time a form is submitted.</span>
    163                 </td>
    164             </tr>
    165             <tr valign="top">
    166                 <th scope="row"><label for="tracksearchforms">Track Search Form Submissions</label></th>
    167                 <td>
    168                     <input name="tracksearchforms" type="checkbox" id="tracksearchforms" value="true" <?php echo get_option("ethoseo_te_tracksearchforms") ? 'checked="checked"' : ""; ?>/>
    169                     <span class="description">Unless this is checked search forms are not tracked.</span>
    170                 </td>
    171             </tr>
    172             <tr valign="top">
    173                 <th scope="row"><label for="trackoutbound">Track Outbound Links</label></th>
    174                 <td>
    175                     <input name="trackoutbound" type="checkbox" id="trackoutbound" value="true" <?php echo get_option("ethoseo_te_trackoutbound") ? 'checked="checked"' : ""; ?>/>
    176                     <span class="description">This will trigger an Event any time an outbound link is triggered. <em>(These will be counted as non-interactions)</em></span>
    177                 </td>
    178             </tr>
    179             <tr valign="top">
    180                 <th scope="row"><label for="trackemail">Track Email Links</label></th>
    181                 <td>
    182                     <input name="trackemail" type="checkbox" id="trackemail" value="true" <?php echo get_option("ethoseo_te_trackemail") ? 'checked="checked"' : ""; ?>/>
    183                     <span class="description">This will trigger an Event any time a <code>mailto:</code> is triggered.</span>
    184                 </td>
    185             </tr>
    186         </table>
    187         <h3>Advanced</h3>
    188         <table class="form-table" style="clear: left; width: auto;">
    189             <tr valign="top">
    190                 <th scope="row"><label for="infooter">Place in Footer</label></th>
    191                 <td>
    192                     <input name="infooter" type="checkbox" id="infooter" value="true" <?php echo get_option("ethoseo_te_infooter") ? 'checked="checked"' : ""; ?>/>
    193                     <span class="description">If things are going wrong with your site try enabling this.</span>
    194                 </td>
    195             </tr>
    196             <tr valign="top">
    197                 <th scope="row"><label for="debug">Debug</label></th>
    198                 <td>
    199                     <input name="debug" type="checkbox" id="debug" value="true" <?php echo get_option("ethoseo_te_debug") ? 'checked="checked"' : ""; ?>/>
    200                     <span class="description">Debug makes Track Everything louder, it will <code>console.log</code> and add classes.</span>
    201                 </td>
    202             </tr>
    203         </table>
    204         <p class="submit"><input type="submit" name="submit" id="submit" class="button-primary" value="Save Changes"    /></p>
    205     </form>
    206 </div>
    207 <?php
     129    include(ETHOSEO_TE_PATH . "inc/screens/$pagename.php");
    208130
    209131}
    210132
     133function ethoseo_te_settings_page() {
     134    ethoseo_te_page('settings');
     135}
     136
    211137function ethoseo_te_special_page() {
    212 
    213     if (!current_user_can('activate_plugins'))  {
    214         wp_die( __('You do not have sufficient permissions to access this page.') );
    215     }
    216     global $wpdb;
    217 
    218     ?>
    219 <div class="wrap">
    220     <div id="icon-track-everything" class="icon32"><br /></div><h2>Track Everything > Specifics</h2>
    221     <?php
    222         if($_POST['submit'] == "Save Changes"){
    223             update_option("ethoseo_te_special", stripslashes_deep($_POST['special']) );
    224 
    225             echo '<div id="setting-error-settings_updated" class="updated settings-error"><p><strong>Settings saved.</strong></p></div>';
    226         }
    227         $special = get_option("ethoseo_te_special");
    228     ?>
    229     <form method="POST">
    230         <p>With Track Eveything, you can track specific events. If you decided to track something, we'll make sure it doesn't get tracked twice.</p>
    231         <table id="special-tracking" class="form-table" style="clear: left; width: auto;">
    232             <tr valign="top">
    233                 <th>Selector</th>
    234                 <th>Category</th>
    235                 <th>Action</th>
    236                 <th>Label</th>
    237                 <th class="event">Event</th>
    238                 <th></th>
    239                 <th></th>
    240             </tr>
    241             <?php
    242                 $possible_events = array("click","dblclick","submit","focus","change","keypress");
    243                 if(!$special[0]) {
    244                     $special = array( array() );
    245                 }
    246                 foreach ($special as $key => $item) {
    247             ?>
    248             <tr valign="top" class="special-group">
    249                 <td><input type="text" name="special[<?php echo $key; ?>][selector]" id="special_<?php echo $key; ?>_selector" placeholder="#myContactForm" data-pattern-name="special[++][selector]" data-pattern-id="special_++_selector" value="<?php echo htmlspecialchars($item['selector']); ?>" /></td>
    250                 <td><input type="text" name="special[<?php echo $key; ?>][category]" id="special_<?php echo $key; ?>_category" placeholder="Forms" data-pattern-name="special[++][category]" data-pattern-id="special_++_category" value="<?php echo htmlspecialchars($item['category']); ?>" /></td>
    251                 <td><input type="text" name="special[<?php echo $key; ?>][action]" id="special_<?php echo $key; ?>_action" placeholder="Submission" data-pattern-name="special[++][action]" data-pattern-id="special_++_action" value="<?php echo htmlspecialchars($item['action']); ?>" /></td>
    252                 <td><input type="text" name="special[<?php echo $key; ?>][label]" id="special_<?php echo $key; ?>_label" placeholder="Contact Form" data-pattern-name="special[++][label]" data-pattern-id="special_++_label" value="<?php echo htmlspecialchars($item['label']); ?>" /></td>
    253                 <td class="event">
    254                     <?php foreach($possible_events as $event){ ?>
    255                         <label><input type="checkbox" name="special[<?php echo $key; ?>][events][<?php echo $event; ?>]" id="special_<?php echo $key; ?>_events_<?php echo $event; ?>" data-pattern-name="special[++][events][<?php echo $event; ?>]" data-pattern-id="special_++_events_<?php echo $event; ?>"<?php if($item['events'][$event]){ echo 'checked="checked"'; } ?>> <?php echo $event; ?></label>
    256                     <?php } ?>
    257                 </td>
    258                 <td><button type="button" class="btnRemove">Remove -</button></td>
    259                 <td><button type="button" class="btnAdd">Add +</button></td>
    260             </tr>
    261             <?php } ?>
    262         </table>
    263         <p class="submit"><input type="submit" name="submit" id="submit" class="button-primary" value="Save Changes"    /></p>
    264     </form>
    265 </div>
    266 <script>
    267 jQuery(function ($){
    268     repeater( "#special-tracking", ".special-group" );
    269 });
    270 
    271 </script>
    272 <?php
    273 
     138    ethoseo_te_page('special');
    274139}
    275140
    276141function ethoseo_te_dictionary_page() {
     142    ethoseo_te_page('dictionary');
     143}
    277144
    278     if (!current_user_can('activate_plugins'))  {
    279         wp_die( __('You do not have sufficient permissions to access this page.') );
    280     }
    281     global $wpdb;
    282 
    283     ?>
    284 <div class="wrap">
    285     <div id="icon-track-everything" class="icon32"><br /></div><h2>Track Everything > Labels</h2>
    286     <?php
    287         if($_POST['submit'] == "Save Changes"){
    288             update_option("ethoseo_te_dictionary", stripslashes_deep($_POST['dictionary']) );
    289 
    290             echo '<div id="setting-error-settings_updated" class="updated settings-error"><p><strong>Settings saved.</strong></p></div>';
    291         }
    292         $dictionary = get_option("ethoseo_te_dictionary");
    293     ?>
    294     <form method="POST">
    295         <p>Track Everything does its best to create descriptive labels for events. However if you want to customize these use CSS selectors to make labels.</p>
    296         <table id="event-dictionary" class="form-table" style="clear: left; width: auto;">
    297             <tr valign="top">
    298                 <th>Selector</th>
    299                 <th>Label</th>
    300                 <th></th>
    301                 <th></th>
    302             </tr>
    303             <?php
    304                 if(!$dictionary[0]) {
    305                     $dictionary = array( array() );
    306                 }
    307                 foreach ($dictionary as $key => $item) {
    308             ?>
    309             <tr valign="top" class="dictionary-group">
    310                 <td><input type="text" name="dictionary[<?php echo $key; ?>][selector]" id="dictionary_<?php echo $key; ?>_selector" placeholder="#myContactForm" data-pattern-name="dictionary[++][selector]" data-pattern-id="dictionary_++_selector"  value="<?php echo htmlspecialchars($item['selector']); ?>" /></td>
    311                 <td><input type="text" name="dictionary[<?php echo $key; ?>][name]" id="dictionary_<?php echo $key; ?>_name" placeholder="Contact Form" data-pattern-name="dictionary[++][name]" data-pattern-id="dictionary_++_name"  value="<?php echo htmlspecialchars($item['name']); ?>"  /></td>
    312                 <td><button type="button" class="btnRemove">Remove -</button></td>
    313                 <td><button type="button" class="btnAdd">Add +</button></td>
    314             </tr>
    315         <?php } ?>
    316         </table>
    317         <p class="submit"><input type="submit" name="submit" id="submit" class="button-primary" value="Save Changes"    /></p>
    318     </form>
    319 </div>
    320 <script>
    321 jQuery(function ($){
    322     repeater( "#event-dictionary", ".dictionary-group" );
    323 });
    324 
    325 </script>
    326 <?php
    327 
     145function ethoseo_te_help_page() {
     146    ethoseo_te_page('help');
    328147}
    329148
  • track-everything/trunk/js/script.js

    r636885 r639533  
    1 function calculateLabel ($obj, possibilities){
     1function ethoseoteCalculateLabel ($obj, possibilities){
    22    var possibilities = (typeof possibilities == 'object') ? possibilities : ["te_name", "name", "title", "id"];
    33    var eventLabel = null;
     
    1111    return eventLabel;
    1212}
    13 function pushEvent ( eventInfo ) {
     13function ethoseotePushEvent ( eventInfo ) {
    1414    if(window.trackeverything.settings.debug){ console.log(eventInfo); }
    1515    _gaq.push(eventInfo);
     
    2525    if(window.trackeverything.settings.forms){
    2626        $("form").on("submit.jqte.jqtedefault", function (e) {
    27             var formLabel = calculateLabel($(this));
     27            var formLabel = ethoseoteCalculateLabel($(this));
    2828
    2929            var eventInfo = ['_trackEvent', 'Form', 'Submission'];
     
    3232            }
    3333            if(!(window.trackeverything.settings.search == false && $(this).attr("method") && $(this).attr("method").toLowerCase() == "get" && $(this).children("input[name=s]").length)){
    34                 pushEvent(eventInfo);
     34                ethoseotePushEvent(eventInfo);
    3535            }
    3636        });
     
    4141    if(window.trackeverything.settings.outbound){
    4242        $("a:external").on("click.jqte.jqtedefault keypress.jqte.jqtedefault", function (e) {
    43             var eventLabel = calculateLabel($(this), ["te_name", "href"]);
     43            var eventLabel = ethoseoteCalculateLabel($(this), ["te_name", "href"]);
    4444
    4545            var eventInfo = ['_trackEvent', 'Link', 'Outbound', eventLabel, null, true];
    46             pushEvent(eventInfo);
     46            ethoseotePushEvent(eventInfo);
    4747        });
    4848        if(window.trackeverything.settings.debug){
     
    5555
    5656            var eventInfo = ['_trackEvent', 'Link', 'Email', eventLabel];
    57             pushEvent(eventInfo);
     57            ethoseotePushEvent(eventInfo);
    5858        });
    5959        if(window.trackeverything.settings.debug){
     
    7575                $(this).attr("te_oname", $special.name);
    7676            }
    77             var eventLabel = calculateLabel($(this), ["te_oname", "te_name", "name", "title", "id", "href"]);
     77            var eventLabel = ethoseoteCalculateLabel($(this), ["te_oname", "te_name", "name", "title", "id", "href"]);
    7878            var eventInfo = ['_trackEvent', $special.category, $special.action, eventLabel];
    7979           
    80             pushEvent(eventInfo);
     80            ethoseotePushEvent(eventInfo);
    8181        });
    8282    };
  • track-everything/trunk/readme.txt

    r636885 r639533  
    44Requires at least: 3.0.1
    55Tested up to: 3.4.2
    6 Stable tag: 1.0.2
     6Stable tag: 1.1.0
    77License: MIT
    88License URI: http://opensource.org/licenses/MIT
     
    4747== Changelog ==
    4848
     49= 1.1.0 =
     50* Focus on UX improvements
     51* Major Re-Work of Plugin Structure
     52* Misc Bug Fixes
     53
    4954= 1.0.2 =
    5055* Fixes to Specific Events
     
    5964== Upgrade Notice ==
    6065
     66= 1.1.0 =
     67Version 1.1.0 provides users with a better experience. Better explanations galore, better code, and bug fixes are all included.
     68
    6169= 1.0.2 =
    6270This version allows for more accurate tracking of Specific Events and contains various bug fixes and improvements.
Note: See TracChangeset for help on using the changeset viewer.