Changeset 639533
- Timestamp:
- 12/15/2012 02:28:08 AM (13 years ago)
- Location:
- track-everything/trunk
- Files:
-
- 8 added
- 4 edited
-
css/admin.css (modified) (1 diff)
-
inc (added)
-
inc/screens (added)
-
inc/screens/dictionary.php (added)
-
inc/screens/help.php (added)
-
inc/screens/settings.php (added)
-
inc/screens/special.php (added)
-
inc/support (added)
-
inc/support/ethoseo.php (added)
-
index.php (modified) (4 diffs)
-
js/script.js (modified) (7 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
track-everything/trunk/css/admin.css
r625290 r639533 6 6 #special-tracking .event label {display:inline-block;width:49%} 7 7 .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 5 5 Description: A plugin capable of adding Google Analytics Event Tracking to <em>everything</em> on a website. 6 6 Author: Ethoseo Internet Marketing 7 Version: 1. 0.27 Version: 1.1.0 8 8 Author URI: http://www.ethoseo.com/ 9 9 License: MIT License … … 20 20 21 21 $ethoseo_te_version = "1.0"; 22 define( 'ETHOSEO_TE_PATH', plugin_dir_path(__FILE__) ); 23 define( 'ETHOSEO_TE_FILE', __FILE__); 22 24 23 25 function ethoseo_te_enqueue() { … … 101 103 $ethoseo_te_special_page = add_submenu_page('track-everything', 'Track Everything > Specific Tracking', 'Specific Events', 'activate_plugins', 'track-everything/specific', 'ethoseo_te_special_page'); 102 104 $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'); 103 106 } 104 107 … … 116 119 } 117 120 118 function ethoseo_te_ settings_page(){121 function ethoseo_te_page ($pagename){ 119 122 120 123 if (!current_user_can('activate_plugins')) { 121 124 wp_die( __('You do not have sufficient permissions to access this page.') ); 122 125 } 126 123 127 global $wpdb; 124 128 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"); 208 130 209 131 } 210 132 133 function ethoseo_te_settings_page() { 134 ethoseo_te_page('settings'); 135 } 136 211 137 function 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'); 274 139 } 275 140 276 141 function ethoseo_te_dictionary_page() { 142 ethoseo_te_page('dictionary'); 143 } 277 144 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 145 function ethoseo_te_help_page() { 146 ethoseo_te_page('help'); 328 147 } 329 148 -
track-everything/trunk/js/script.js
r636885 r639533 1 function calculateLabel ($obj, possibilities){1 function ethoseoteCalculateLabel ($obj, possibilities){ 2 2 var possibilities = (typeof possibilities == 'object') ? possibilities : ["te_name", "name", "title", "id"]; 3 3 var eventLabel = null; … … 11 11 return eventLabel; 12 12 } 13 function pushEvent ( eventInfo ) {13 function ethoseotePushEvent ( eventInfo ) { 14 14 if(window.trackeverything.settings.debug){ console.log(eventInfo); } 15 15 _gaq.push(eventInfo); … … 25 25 if(window.trackeverything.settings.forms){ 26 26 $("form").on("submit.jqte.jqtedefault", function (e) { 27 var formLabel = calculateLabel($(this));27 var formLabel = ethoseoteCalculateLabel($(this)); 28 28 29 29 var eventInfo = ['_trackEvent', 'Form', 'Submission']; … … 32 32 } 33 33 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); 35 35 } 36 36 }); … … 41 41 if(window.trackeverything.settings.outbound){ 42 42 $("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"]); 44 44 45 45 var eventInfo = ['_trackEvent', 'Link', 'Outbound', eventLabel, null, true]; 46 pushEvent(eventInfo);46 ethoseotePushEvent(eventInfo); 47 47 }); 48 48 if(window.trackeverything.settings.debug){ … … 55 55 56 56 var eventInfo = ['_trackEvent', 'Link', 'Email', eventLabel]; 57 pushEvent(eventInfo);57 ethoseotePushEvent(eventInfo); 58 58 }); 59 59 if(window.trackeverything.settings.debug){ … … 75 75 $(this).attr("te_oname", $special.name); 76 76 } 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"]); 78 78 var eventInfo = ['_trackEvent', $special.category, $special.action, eventLabel]; 79 79 80 pushEvent(eventInfo);80 ethoseotePushEvent(eventInfo); 81 81 }); 82 82 }; -
track-everything/trunk/readme.txt
r636885 r639533 4 4 Requires at least: 3.0.1 5 5 Tested up to: 3.4.2 6 Stable tag: 1. 0.26 Stable tag: 1.1.0 7 7 License: MIT 8 8 License URI: http://opensource.org/licenses/MIT … … 47 47 == Changelog == 48 48 49 = 1.1.0 = 50 * Focus on UX improvements 51 * Major Re-Work of Plugin Structure 52 * Misc Bug Fixes 53 49 54 = 1.0.2 = 50 55 * Fixes to Specific Events … … 59 64 == Upgrade Notice == 60 65 66 = 1.1.0 = 67 Version 1.1.0 provides users with a better experience. Better explanations galore, better code, and bug fixes are all included. 68 61 69 = 1.0.2 = 62 70 This 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.