Plugin Directory

Changeset 980785


Ignore:
Timestamp:
09/04/2014 11:52:03 PM (12 years ago)
Author:
segmentio
Message:

merge 1.0.4 into svn

Location:
segmentio/trunk
Files:
8 added
6 edited

Legend:

Unmodified
Added
Removed
  • segmentio/trunk/Readme.md

    r949997 r980785  
    1818```
    1919
     20## Contributing
     21
     22We'd love to have you contribute to the Segment WordPress plugin.  We'll gladly review any pull request, but pull requests that have followed recommended practices are more likely to be merged:
     23
     241. Our recommended development environment for contributing to the Segment WordPress plugin is called [VVV](https://github.com/Varying-Vagrant-Vagrants/VVV).  It's a community-developed Vagrant environment for WordPress.  If you do any WordPress development at all, you won't find a better development environment.  We highly recommend using it.
     251. After you've installed VVV, `vagrant up`, change directories to whichever WordPress install you're developing against, and `git clone https://github.com/your-user-account/analytics-wordpress.git` into the plugins directory.  This assumes you've already forked the Segment WordPress plugin.  If you haven't, be sure to do so.
     261. Boom, you're ready to go!  Go to the WordPress instance you're using (consult the [VVV documentation](https://github.com/Varying-Vagrant-Vagrants/VVV/blob/master/README.md#wordpress-stable) if you're not sure which to use) and activate the Segment plugin.
     271. Now you're ready to make your changes.  Fixing a bug? Awesome! Write unit tests.  Adding a feature? Sweet! Write unit tests. Check out our [current tests in the tests folder](https://github.com/segmentio/analytics-wordpress/tree/master/tests) for reference.
     281. Once your changes are made and tests are written, confirm that all tests and assertions are passing by running `phpunit` from the command line in the plugin directory.
     291. Commit, send your pull request, and pat yourself on the back for contributing to open source software!
    2030
    2131## Support
  • segmentio/trunk/analytics-wordpress.php

    r950002 r980785  
    44Plugin URI: https://segment.io/plugins/wordpress
    55Description: The hassle-free way to integrate any analytics service into your WordPress site.
    6 Version: 1.0.3
     6Version: 1.0.4
    77License: GPLv2
    88Author: Segment.io
     
    135135
    136136    /**
    137      * Render a Javascript `track` call
     137     * Render a Javascript `page` call
    138138     *
    139139     * @since  1.0.0
     
    179179     * Current plugin version.
    180180     */
    181     const VERSION = '1.0.3';
     181    const VERSION = '1.0.4';
    182182
    183183    /**
     
    242242        'track_comments'    => 1,
    243243
     244        // Whether or not we should use Intercom's Secure Mode
     245        'use_intercom_secure_mode'    => '',
     246
     247        // Whether or not we should track custom events for searches
     248        'track_searches'    => 1,
     249
    244250        // Whether or not we should track custom events for users logging in
    245251        'track_logins'      => 1,
     
    293299     */
    294300    public function admin_hooks() {
    295 
    296         if ( is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) )  {
    297 
    298             add_action( 'admin_menu'         , array( $this, 'admin_menu' ) );
    299             add_filter( 'plugin_action_links', array( $this, 'plugin_action_links' ), 10, 2 );
    300             add_filter( 'plugin_row_meta'    , array( $this, 'plugin_row_meta' )    , 10, 2 );
    301             add_action( 'admin_init'         , array( $this, 'register_settings' ) );
    302         }
    303 
     301        add_action( 'admin_menu'         , array( self::$instance, 'admin_menu' ) );
     302        add_filter( 'plugin_action_links', array( self::$instance, 'plugin_action_links' ), 10, 2 );
     303        add_filter( 'plugin_row_meta'    , array( self::$instance, 'plugin_row_meta' )    , 10, 2 );
     304        add_action( 'admin_init'         , array( self::$instance, 'register_settings' ) );
    304305    }
    305306
     
    332333    public function frontend_hooks() {
    333334
    334         add_action( 'wp_head'          , array( $this, 'wp_head' )       , 9    );
    335         add_action( 'admin_head'       , array( $this, 'wp_head' )       , 9    );
    336         add_action( 'login_head'       , array( $this, 'wp_head' )       , 9    );
    337         add_action( 'wp_footer'        , array( $this, 'wp_footer' )     , 9    );
    338         add_action( 'login_footer'     , array( $this, 'wp_footer' )     , 9    );
    339         add_action( 'admin_footer'     , array( $this, 'wp_footer' )     , 9    );
    340         add_action( 'wp_insert_comment', array( $this, 'insert_comment' ), 9, 2 );
    341         add_action( 'wp_login'         , array( $this, 'login_event'    ), 9, 2 );
    342         add_action( 'user_register'    , array( $this, 'user_register'  ), 9    );
    343     }
    344 
    345     /**
    346      * Registers our settings, fields and sections using the WordPress Settings API.
    347      *
    348      * Developers should use the `segment_default_settings` filter to add settings.
    349      * They should also use the `segm.ent_settings_core_validation` filter to validate
    350      * any settings they add.
    351      *
    352      * @since  1.0.0
    353      * @return void
    354      */
    355     public function register_settings() {
    356 
    357         $settings = apply_filters( 'segment_default_settings', array(
     335        add_action( 'wp_head'          , array( self::$instance, 'wp_head' )       , 9    );
     336        add_action( 'admin_head'       , array( self::$instance, 'wp_head' )       , 9    );
     337        add_action( 'login_head'       , array( self::$instance, 'wp_head' )       , 9    );
     338        add_action( 'wp_footer'        , array( self::$instance, 'wp_footer' )     , 9    );
     339        add_action( 'login_footer'     , array( self::$instance, 'wp_footer' )     , 9    );
     340        add_action( 'admin_footer'     , array( self::$instance, 'wp_footer' )     , 9    );
     341        add_action( 'wp_insert_comment', array( self::$instance, 'insert_comment' ), 9, 2 );
     342        add_action( 'wp_login'         , array( self::$instance, 'login_event'    ), 9, 2 );
     343        add_action( 'user_register'    , array( self::$instance, 'user_register'  ), 9    );
     344    }
     345
     346    /**
     347     * Returns array of settings.
     348     *
     349     * @since  1.0.4
     350     */
     351    public function _get_default_settings() {
     352        return apply_filters( 'segment_default_settings', array(
    358353                'general' => array(
    359354                    'title'    => __( 'General', 'segment' ),
     
    431426            )
    432427        );
     428    }
     429
     430    /**
     431     * Registers our settings, fields and sections using the WordPress Settings API.
     432     *
     433     * Developers should use the `segment_default_settings` filter to add settings.
     434     * They should also use the `segment_settings_core_validation` filter to validate
     435     * any settings they add.
     436     *
     437     * @since  1.0.0
     438     * @return void
     439     */
     440    public function register_settings() {
     441
     442        $settings = $this->_get_default_settings();
    433443
    434444        register_setting( self::SLUG, $this->get_option_name(), array( 'Segment_Settings', 'core_validation' ) );
    435445
    436446        foreach ( $settings as $section_name => $section ) {
     447
    437448            add_settings_section(
    438449                $section_name,
     
    714725     *                    An array of the user ID and traits if there is an authenticated user.
    715726     */
    716     private function get_current_user_identify() {
     727    public function get_current_user_identify() {
    717728        $settings  = $this->get_settings();
    718729
    719730        $user      = wp_get_current_user();
    720         $commenter = wp_get_current_commenter();
     731        $commenter = array_filter( wp_get_current_commenter() );
    721732        $identify  = false;
    722733
     
    880891        if ( $settings['track_comments'] ) {
    881892
    882             $commenter = wp_get_current_commenter();
    883             $hash      = md5( json_encode( $commenter ) );
    884 
    885             if ( Segment_Cookie::get_cookie( 'left_comment', $hash ) ) {
    886 
    887                 $track = array(
    888                     'event'      => __( 'Commented', 'segment' ),
    889                     'properties' => array(
    890                         'commenter' => $commenter
    891                     ),
    892                     'http_event' => 'left_comment'
    893                 );
     893            $commenter = array_filter( wp_get_current_commenter() );
     894
     895            if ( $commenter ) {
     896                $hash = md5( json_encode( $commenter ) );
     897
     898                if ( Segment_Cookie::get_cookie( 'left_comment', $hash ) ) {
     899
     900                    $track = array(
     901                        'event'      => __( 'Commented', 'segment' ),
     902                        'properties' => array(
     903                            'commenter' => $commenter
     904                        ),
     905                        'http_event' => 'left_comment'
     906                    );
     907                }
    894908            }
    895909
  • segmentio/trunk/includes/class.segment-cookie.php

    r948394 r980785  
    2424     */
    2525    public static function set_cookie( $key, $value ) {
    26         setcookie( 'segment_' . $key . '_' . COOKIEHASH, $value, time() + DAY_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN );
     26        @ setcookie( 'segment_' . $key . '_' . COOKIEHASH, $value, time() + DAY_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN );
    2727        $_COOKIE[ 'segment_' . $key . '_' . COOKIEHASH ] = $value;
    2828    }
     
    6464        }
    6565
    66         setcookie( 'segment_' . $key . '_' . COOKIEHASH, '', time() - DAY_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN );
     66        @ setcookie( 'segment_' . $key . '_' . COOKIEHASH, '', time() - DAY_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN );
    6767        unset( $_COOKIE[ 'segment_' . $key . '_' . COOKIEHASH ] );
    6868
  • segmentio/trunk/includes/class.segment-settings.php

    • Property svn:executable set to *
    r948394 r980785  
    216216        $input[ $int ] = isset( $input[ $int ] ) ? absint( $input[ $int ] ) : '';
    217217
    218 
    219 
    220218        return apply_filters( 'segment_settings_core_validation', $input );
    221219    }
  • segmentio/trunk/integrations/ecommerce/woocommerce.php

    r949997 r980785  
    147147            }
    148148
    149             $items    = WC()->cart->get_cart();
    150149            $_product = json_decode( $cookie );
    151150
     
    229228                return $track;
    230229            }
    231 
    232             $items = WC()->cart->get_cart();
    233230
    234231            $_product  = json_decode( $cookie );
  • segmentio/trunk/readme.txt

    r950002 r980785  
    1 === Analytics for WordPress — by Segment.io ===
    2 Contributors: segmentio
     1=== Analytics for WordPress — by Segment ===
     2Contributors: segmentio, JustinSainton
    33Tags: analytics, web analytics, segment.io, google analytics, kissmetrics, mixpanel, chartbeat, hubspot, marketo, quantcast, tag manager
    44Requires at least: 3.6
    5 Tested up to: 3.9.2
    6 Stable tag: 1.0.3
     5Tested up to: 4.0
     6Stable tag: 1.0.4
    77License: GPLv2
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
    99
    10 Analytics for WordPress is the easiest way to integrate analytics into your WordPress site.
     10Analytics for WordPress lets you integrate more than 100 analytics and marketing tools with the flick of a switch.
    1111
    1212
    1313== Description ==
    1414
    15 Analytics for WordPress is the easiest way to integrate analytics into your WordPress site.
     15Analytics for WordPress is the easiest way to integrate analytics and marketing tools into your WordPress site.
    1616
    17 By installing Segment.io's WordPress plugin you can add any analytics service to your site without touching any code.
     17Instead of installing each tool individually, just install Segment's WordPress plugin and use Segment to integrate third-party analytics and marketing tools.   Once you're setup, you can swap and add new analytics services with the flick of a switch!
    1818
    19 Segment.io lets you send your analytics data to Google Analytics, Mixpanel, KISSmetrics, Chartbeat, and more... without having to integrate with each and every one, saving you time.
     19Here's how it works:
     20* Install the Segment plugin
     21* Segment will automatically start tracking how people are using your site – what pages they view and the information they provide to you, like their emails
     22* Go to the Segment control panel, and toggle on any tool you want to try like Google Analytics, KISSmetrics and Facebook Audiences
     23* Segment will send this data along to each tool
     24* The service is fully integrated into your site–zero code required!
    2025
    21 Once you're setup, you can swap and add new analytics services with the click of a button!
     26You can use Segment to try out more than a hundred vendors in a number of categories. Here are just a few of our most popular integrations:
     27* **Advertising** – AdRoll, Google Adwords, Facebook Audiences, Twitter Ads, Quantcast, AppNexus
     28* **Analytics** – Google Analytics, KISSmetrics, Mixpanel, Amplitude, Chartbeat, Go Squared
     29* **CRM** – Salesforce, Zendesk, Gainsight, Frontleaf
     30* **Email** – Customer.io, Outbound, Vero, Marketo, MailChimp, Hubspot
     31* **Optimization** – Optimizely, CrazyEgg, Visual Website Optimizer
    2232
     33Get started with Analytics for WordPress today!
    2334
    2435== Installation ==
    2536
    26371. Go to the **Plugins > Add New** page in your WordPress admin.
    27 1. Search for "Segment.io" and install **Analytics for WordPress — by Segment.io**.
     381. Search for "Segment" and install **Analytics for WordPress — by Segment.io**.
    28391. Click **Activate Plugin**.
    29 1. Go to **Settings > Analytics** and enter your Segment.io API key. (If you haven't signed up for Segment.io yet, now's the time!)
     401. Go to **Settings > Analytics** and enter your Segment API key. (If you haven't signed up for Segment yet, now's the time!)
    3041
    31 That's it! You can now turn on any analytics service with the click of a button in the Segment.io interface.
     42That's it! You can now turn on any analytics service with the flick of a switch in the Segment control panel.
    3243
    3344
     
    6475
    6576== Changelog ==
     77
     78= 1.0.4 =
     79* Fixed identify() method to only be called for logged-in users and commenters.
     80
     81= 1.0.3 =
     82* Fixed deployment logic
    6683
    6784= 1.0.2 =
Note: See TracChangeset for help on using the changeset viewer.