Plugin Directory

Changeset 715795


Ignore:
Timestamp:
05/20/2013 11:06:40 PM (13 years ago)
Author:
segmentio
Message:

0.5.4

Location:
segmentio/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • segmentio/trunk/analytics-wordpress.php

    r713156 r715795  
    55Description: The hassle-free way to integrate any analytics service into your Wordpress site.
    66
    7 Version: 0.5.3
     7Version: 0.5.4
    88License: GPLv2
    99
     
    2525
    2626  // Render the Segment.io Javascript snippet.
    27   public function initialize($settings) {
     27  public function initialize($settings, $ignore = false) {
     28    // An API key is required.
    2829    if (!isset($settings['api_key']) || $settings['api_key'] == '') return;
     30
    2931    include(plugin_dir_path(__FILE__) . 'templates/snippet.php');
    3032  }
     
    6062
    6163  const SLUG    = 'analytics';
    62   const VERSION = '0.5.3';
     64  const VERSION = '0.5.4';
    6365
    6466  private $option   = 'analytics_wordpress_options';
     
    106108
    107109  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
    108116    // Render the snippet.
    109     Analytics::initialize($this->get_settings());
     117    Analytics::initialize($this->get_settings(), $ignore);
    110118  }
    111119
     
    200208    $user = wp_get_current_user();
    201209    $commenter = wp_get_current_commenter();
    202 
    203     // If our user's permissions level is greater than or equal to our
    204     // ignored level, get out of here.
    205     if (($user->user_level >= $settings['ignore_user_level'])) return false;
    206210
    207211    // We've got a logged-in user.
     
    247251  private function get_current_page_track() {
    248252    $settings = $this->get_settings();
    249     $user = wp_get_current_user();
    250 
    251     // If our user's permissions level is greater than or equal to our
    252     // ignored level, get out of here.
    253     if (($user->user_level >= $settings['ignore_user_level'])) return false;
    254253
    255254    // Posts
     
    287286      }
    288287    }
     288    // We don't have a user.
     289    else return false;
    289290
    290291    // Archives
  • segmentio/trunk/readme.txt

    r713156 r715795  
    44Requires at least: 3.4
    55Tested up to: 3.5.1
    6 Stable tag: 0.5.3
     6Stable tag: 0.5.4
    77License: GPLv2
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    5555== Changelog ==
    5656
     57= 0.5.4 =
     58* Fixed a bug where admins weren't being properly ignored.
     59
    5760= 0.5.3 =
    5861* Fixed a bug that occured in older versions of PHP.
  • segmentio/trunk/templates/snippet.php

    r680923 r715795  
    11<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'] . '");'; ?>
    44</script>
Note: See TracChangeset for help on using the changeset viewer.