This simple web application gets the results for the first 10 active experiments in a project and exports the results to a CSV file. Learn more.
19 |To use this application, first generate an API Token at optimizely.com/tokens and enter it in the text box below. Next, click Show Projects to show the projects in your account. Finally, choose a project to generate results for and click Download Results to generate a CSV file.
20 |
21 |
22 |
23 |
24 |
Settings saved.
".__('Optimizely is almost ready.')." ".sprintf(__('You must authenticate and choose a project to begin using Optimizely on your site.'), "admin.php?page=optimizely-config")."
"; 25 | $contents .= ""; 26 | $contents .= ""; 27 | $contents .= "
"; 28 | } 29 | 30 | if ( can_create_experiments() ) { 31 | echo $contents; 32 | 33 | ?> 34 |Status: = get_post_meta($post->ID, 'optimizely_experiment_status', true); ?>
42 |
43 | Results: View Results
Please configure your API credentials in the Optimizely settings page.
59 | -------------------------------------------------------------------------------- /wordpress_plugin/optimizely/optimizely.js: -------------------------------------------------------------------------------- 1 | /* 2 | The OptimizelyAPI class provides a connection to the API via Javascript and lets you make authenticated calls without repeating yourself. 3 | 4 | We store the API token in each instance of the object, and we can connect to multiple different accounts by creating new instances of the OptimizelyAPI class. 5 | 6 | Finally, we keep track of how many requests are outstanding so we can tell when all the calls are complete. 7 | */ 8 | 9 | OptimizelyAPI = function(token) { 10 | this.outstandingRequests = 0; 11 | this.token = token; 12 | } 13 | 14 | /* 15 | To call the API, we use jQuery's `$.ajax` function, which sends an asynchronous request based on a set of `options`. 16 | 17 | Our function takes four arguments: 18 | 19 | * The request `type`, like GET or POST 20 | * The `endpoint` to hit, like `projects/27` 21 | * The `data` to send along with a POST or PUT request 22 | * A `callback` function to run when the operation is done. The callback should take one argument, the `response`. 23 | 24 | We construct the URL by appending the endpoint to the base API link, and we authenticate by adding the token in the headers section. 25 | 26 | To send data, we set content type to JSON and encode the array as a JSON string to send over the wire. 27 | */ 28 | 29 | OptimizelyAPI.prototype.call = function(type, endpoint, data, callback) { 30 | 31 | var self = this; 32 | 33 | var options = { 34 | url: "https://www.optimizelyapis.com/experiment/v1/" + endpoint, 35 | type: type, 36 | headers: {"Token": this.token}, 37 | contentType: 'application/json', 38 | success: function(response) { 39 | self.outstandingRequests -= 1; 40 | callback(response); 41 | } 42 | } 43 | 44 | if (data) { 45 | options.data = JSON.stringify(data); 46 | options.dataType = 'json'; 47 | } 48 | 49 | this.outstandingRequests += 1; 50 | jQuery.ajax(options); 51 | 52 | } 53 | 54 | /* 55 | Using our `call` function, we can define convenience functions for GETs, POSTs, PUTs, and DELETEs. 56 | */ 57 | 58 | OptimizelyAPI.prototype.get = function(endpoint, callback) { 59 | this.call('GET', endpoint, "", callback); 60 | } 61 | 62 | OptimizelyAPI.prototype.delete = function(endpoint, callback) { 63 | this.call('DELETE', endpoint, "", callback); 64 | } 65 | 66 | OptimizelyAPI.prototype.post = function(endpoint, data, callback) { 67 | this.call('POST', endpoint, data, callback); 68 | } 69 | 70 | OptimizelyAPI.prototype.put = function(endpoint, data, callback) { 71 | this.call('PUT', endpoint, data, callback); 72 | } 73 | 74 | /* 75 | We've also added an extra convenience function, `patch`, that updates a model by changing only the specified fields. The function works by reading in an entity, changing a few keys, and then sending it back to Optimizely. 76 | */ 77 | 78 | OptimizelyAPI.prototype.patch = function(endpoint, data, callback) { 79 | var self = this; 80 | self.get(endpoint, function(base) { 81 | for (var key in data) { 82 | base[key] = data[key]; 83 | } 84 | self.put(endpoint, base, callback); 85 | }); 86 | } -------------------------------------------------------------------------------- /wordpress_plugin/optimizely/optimizely.php: -------------------------------------------------------------------------------- 1 | Optimizely is a dramatically easier way for you to improve your website through A/B testing. Create an experiment in minutes with our easy-to-use visual interface with absolutely no coding or engineering required. Convert your website visitors into customers and earn more revenue today! To get started: 1) Click the "Activate" link to the left of this description, 2) Sign up for an Optimizely account, and 3) Go to the settings page, and enter your Optimizely project code. 10 | Author: Arthur Suermondt & Jon Noronha 11 | Version: 2.0.0 12 | Author URI: http://www.optimizely.com/ 13 | License: GPL2 14 | */ 15 | 16 | /* Copyright 2012 Arthur Suermondt (email: support@optimizely.com) 17 | 18 | This program is free software; you can redistribute it and/or modify 19 | it under the terms of the GNU General Public License, version 2, as 20 | published by the Free Software Foundation. 21 | 22 | This program is distributed in the hope that it will be useful, 23 | but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | GNU General Public License for more details. 26 | 27 | You should have received a copy of the GNU General Public License 28 | along with this program; if not, write to the Free Software 29 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 30 | */ 31 | if ( is_admin() ) 32 | require_once dirname( __FILE__ ) . '/admin.php'; 33 | require_once dirname( __FILE__ ) . '/edit.php'; 34 | wp_enqueue_script('jquery'); 35 | wp_enqueue_script('optimizely_api', plugins_url('optimizely.js', __FILE__)); 36 | wp_enqueue_script('optimizely_editor', plugins_url('edit.js', __FILE__)); 37 | wp_localize_script('optimizely_editor', 'wpAjaxUrl', admin_url('admin-ajax.php')); 38 | wp_enqueue_script('optimizely_config', plugins_url('config.js', __FILE__)); 39 | wp_enqueue_style('optimizely_styles', plugins_url('style.css', __FILE__)); 40 | 41 | 42 | $DEFAULT_VARIATION_TEMPLATE = '$(".post-$POST_ID .entry-title a").text("$NEW_TITLE");'; 43 | add_option('optimizely_variation_template', $DEFAULT_VARIATION_TEMPLATE); 44 | 45 | // Force Optimizely to load first in the head tag 46 | add_action('wp_head', 'add_optimizely_script', -1000); 47 | 48 | function add_optimizely_script() { 49 | echo get_option('optimizely_project_code'); 50 | } 51 | 52 | function can_create_experiments() { 53 | return get_option('optimizely_token'); 54 | } 55 | 56 | ?> -------------------------------------------------------------------------------- /wordpress_plugin/optimizely/readme.txt: -------------------------------------------------------------------------------- 1 | === Optimizely === 2 | Contributors: arthuracs, jonslaught 3 | Tags: optimizely, ab testing, split testing, website optimization 4 | Requires at least: 3.0 5 | Tested up to: 3.9 6 | Stable tag: 2.0.0 7 | License: GPLv2 or later 8 | License URI: http://www.gnu.org/licenses/gpl-2.0.html 9 | 10 | This plugin helps you configure your WordPress website to use Optimizely, a dramatically easier way to improve your website through A/B testing. 11 | 12 | == Description == 13 | 14 | This plugin helps you configure your WordPress website to use Optimizely. After setting up an account at Optimizely.com, you simply enter your Optimizely project code in the plugin's configuration page and you're ready to start improving your website using Optimizely. 15 | 16 | Optimizely is a dramatically easier way for you to improve your website through A/B testing. Create an experiment in minutes with our easy-to-use visual interface with absolutely no coding or engineering required. Convert your website visitors into customers and earn more revenue today! 17 | 18 | You'll need an [Optimizely.com](http://www.optimizely.com) account to use it. 19 | 20 | == Installation == 21 | 22 | Sign up at [Optimizely.com](http://www.optimizely.com). 23 | 24 | 1. Upload the Optimizely WordPress plugin to your blog 25 | 2. Activate the plugin through the 'Plugins' menu in WordPress 26 | 3. Enter your Optimizely API token in the plugin's settings page, choose a project to use, then save. 27 | 28 | You're ready to start using Optimizely! 29 | 30 | == Changelog == 31 | 32 | = 2.0.0 = 33 | * Added headline testing 34 | 35 | = 1.0.1 = 36 | * Prioritizing the Optimizely code snippet so that it appears above other scripts. 37 | 38 | = 1.0.0 = 39 | * Introducing the Optimizely WordPress plugin. Now it's even easier to start improving your website. 40 | -------------------------------------------------------------------------------- /wordpress_plugin/optimizely/style.css: -------------------------------------------------------------------------------- 1 | .code { 2 | width: 100%; 3 | font-family: Consolas, Monaco, "Courier New", Courier, monospace; 4 | font-size: 1.5em; 5 | } --------------------------------------------------------------------------------