How to use this plugin on your own server

Requirements

jQuery.AB.js is a plugin built for jQuery that allows for A/B testing on any of your websites. In order to run the server code provided with this plugin on your own server, you will need:

  1. PHP
  2. PHP PDO
  3. MySQL

Get the Code

Download all the code here: jQuery.ab.current.zip

Contents:

  1. jQuery.ab.js – The plugin source
  2. serv.php – The server PHP code
  3. jquery.ab.sql – A SQL file to create the database

Configure The Plugin and Server

  1. Create a database on your MySQL server:
    CREATE DATABASE jquery_ab;
  2. Create a database user and grant permissions.
    CREATE USER 'jquery_ab_user'@'localhost' IDENTIFIED BY PASSWORD('jquery_ab_pass');
    GRANT INSERT, UPDATE, SELECT ON 'jquery_ab'.* TO 'jquery_ab'@'localhost';
  3. Modify db.inc.php lines 2-5 with the information and credentials created in the last two steps.
    $_HOST = "localhost";
    $_DB = "jquery_ab";
    $_USER = "jquery_ab_user";
    $_PASS = "jquery_ab_pass";
  4. Optional: set default URL in jquery.ab.js
    var defaults = {
    URL: "http://www.yourdomain.com/path/to/serv.php",
    els: this,
    idx: Math.round(Math.random()*(this.length-1)),
    testname: 'default',
    action_el: null,
    action_ev: 'click'
    }

Congratulations, You are done!

Wasn’t that easy?

For usage instructions: Click Here

Having troubles? Check-out the Troubleshooting Guide