Plugin Directory

Changeset 709542


Ignore:
Timestamp:
05/07/2013 08:50:38 PM (13 years ago)
Author:
segmentio
Message:

0.5.2

Location:
segmentio/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • segmentio/trunk/.gitignore

    r661998 r709542  
    1 .DS_Store
    2 *.sublime*
    31test
  • segmentio/trunk/Makefile

    r661979 r709542  
    22# Open the WordPress site and admin.
    33test:
    4         open http://localhost:8888/wp-admin/options-general.php?page=analytics-wordpress
    5         open http://localhost:8888/
     4        open http://localhost:8888/analytics-wordpress/test/wp-admin/options-general.php?page=analytics-wordpress
     5        open http://localhost:8888/analytics-wordpress/test/
    66
    77# Turns the testing plugin into a real folder, for more accurate testing.
  • segmentio/trunk/analytics-wordpress.php

    r683366 r709542  
    55Description: The hassle-free way to integrate any analytics service into your Wordpress site.
    66
    7 Version: 0.5.1
     7Version: 0.5.2
    88License: GPLv2
    99
     
    3131
    3232  // Render a Javascript `identify` call.
    33   public function identify($user_id, $traits = false) {
     33  public function identify($user_id, $traits = array(), $options = array()) {
     34    // A user ID is required.
    3435    if (!$user_id) return;
     36
     37    // Set the proper `library` option so we know where the API calls come from.
     38    $options['library'] = 'analytics-wordpress';
     39
    3540    include(plugin_dir_path(__FILE__) . 'templates/identify.php');
    3641  }
    3742
    3843  // Render a Javascript `track` call.
    39   public function track($event, $properties = false) {
     44  public function track($event, $properties = array(), $options = array()) {
     45    // An event is required.
    4046    if (!$event) return;
     47
     48    // Set the proper `library` option so we know where the API calls come from.
     49    $options['library'] = 'analytics-wordpress';
     50
    4151    include(plugin_dir_path(__FILE__) . 'templates/track.php');
    4252  }
  • segmentio/trunk/readme.txt

    r683366 r709542  
    44Requires at least: 3.4
    55Tested up to: 3.5.1
    6 Stable tag: 0.5.1
     6Stable tag: 0.5.2
    77License: GPLv2
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    5555== Changelog ==
    5656
     57= 0.5.2 =
     58* Added `'analytics-wordpress'` `library` option.
     59
    5760= 0.5.1 =
    5861* Fixed a bug where the user permission level would be output.
  • segmentio/trunk/templates/identify.php

    r680923 r709542  
    11<script type="text/javascript">
    2   analytics.identify(<?php echo "'" . $user_id . "'"; if ($traits) echo ', ' . json_encode($traits); ?>);
     2  analytics.identify(<?php echo '"' . $user_id . '"' ?>, <?php echo json_encode($traits, JSON_FORCE_OBJECT); ?>, <?php echo json_encode($options, JSON_FORCE_OBJECT); ?>);
    33</script>
  • segmentio/trunk/templates/track.php

    r680923 r709542  
    11<script type="text/javascript">
    2   analytics.track(<?php echo "'" . $event . "'"; if ($properties) echo ', ' . json_encode($properties); ?>);
     2  analytics.track(<?php echo '"' . $event . '"' ?>, <?php echo json_encode($properties, JSON_FORCE_OBJECT); ?>, <?php echo json_encode($options, JSON_FORCE_OBJECT); ?>);
    33</script>
Note: See TracChangeset for help on using the changeset viewer.