Changeset 715795
- Timestamp:
- 05/20/2013 11:06:40 PM (13 years ago)
- Location:
- segmentio/trunk
- Files:
-
- 3 edited
-
analytics-wordpress.php (modified) (7 diffs)
-
readme.txt (modified) (2 diffs)
-
templates/snippet.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
segmentio/trunk/analytics-wordpress.php
r713156 r715795 5 5 Description: The hassle-free way to integrate any analytics service into your Wordpress site. 6 6 7 Version: 0.5. 37 Version: 0.5.4 8 8 License: GPLv2 9 9 … … 25 25 26 26 // Render the Segment.io Javascript snippet. 27 public function initialize($settings) { 27 public function initialize($settings, $ignore = false) { 28 // An API key is required. 28 29 if (!isset($settings['api_key']) || $settings['api_key'] == '') return; 30 29 31 include(plugin_dir_path(__FILE__) . 'templates/snippet.php'); 30 32 } … … 60 62 61 63 const SLUG = 'analytics'; 62 const VERSION = '0.5. 3';64 const VERSION = '0.5.4'; 63 65 64 66 private $option = 'analytics_wordpress_options'; … … 106 108 107 109 public function wp_head() { 110 // Figure out whether the user should be ignored or not. 111 $ignore = false; 112 $settings = $this->get_settings(); 113 $user = wp_get_current_user(); 114 if (($user->user_level >= $settings['ignore_user_level'])) $ignore = true; 115 108 116 // Render the snippet. 109 Analytics::initialize($this->get_settings() );117 Analytics::initialize($this->get_settings(), $ignore); 110 118 } 111 119 … … 200 208 $user = wp_get_current_user(); 201 209 $commenter = wp_get_current_commenter(); 202 203 // If our user's permissions level is greater than or equal to our204 // ignored level, get out of here.205 if (($user->user_level >= $settings['ignore_user_level'])) return false;206 210 207 211 // We've got a logged-in user. … … 247 251 private function get_current_page_track() { 248 252 $settings = $this->get_settings(); 249 $user = wp_get_current_user();250 251 // If our user's permissions level is greater than or equal to our252 // ignored level, get out of here.253 if (($user->user_level >= $settings['ignore_user_level'])) return false;254 253 255 254 // Posts … … 287 286 } 288 287 } 288 // We don't have a user. 289 else return false; 289 290 290 291 // Archives -
segmentio/trunk/readme.txt
r713156 r715795 4 4 Requires at least: 3.4 5 5 Tested up to: 3.5.1 6 Stable tag: 0.5. 36 Stable tag: 0.5.4 7 7 License: GPLv2 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 55 55 == Changelog == 56 56 57 = 0.5.4 = 58 * Fixed a bug where admins weren't being properly ignored. 59 57 60 = 0.5.3 = 58 61 * Fixed a bug that occured in older versions of PHP. -
segmentio/trunk/templates/snippet.php
r680923 r715795 1 1 <script type="text/javascript"> 2 var analytics=analytics||[]; analytics.load=function(e){var t=document.createElement("script");t.type="text/javascript",t.async=!0,t.src=("https:"===document.location.protocol?"https://":"http://")+"d2dq2ahtl5zl1z.cloudfront.net/analytics.js/v1/"+e+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(t,n);var r=function(e){return function(){analytics.push([e].concat(Array.prototype.slice.call(arguments,0)))}},i=["identify","track","trackLink","trackForm","trackClick","trackSubmit","pageview","ab","alias"];for(var s=0;s<i.length;s++)analytics[i[s]]=r(i[s])};3 analytics.load("<?php echo $settings['api_key']; ?>");2 var analytics=analytics||[];(function(){var e=["identify","track","trackLink","trackForm","trackClick","trackSubmit","pageview","ab","alias","ready","group"],t=function(e){return function(){analytics.push([e].concat(Array.prototype.slice.call(arguments,0)))}};for(var n=0;n<e.length;n++)analytics[e[n]]=t(e[n])})(),analytics.load=function(e){var t=document.createElement("script");t.type="text/javascript",t.async=!0,t.src=("https:"===document.location.protocol?"https://":"http://")+"d2dq2ahtl5zl1z.cloudfront.net/analytics.js/v1/"+e+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(t,n)}; 3 <?php if (!$ignore) echo 'analytics.load("' . $settings['api_key'] . '");'; ?> 4 4 </script>
Note: See TracChangeset
for help on using the changeset viewer.