Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

-bug fix to fix tracking of larger values than 1

-and a few other small changes
  • Loading branch information...
commit daae64e4a58f95006d55f6aac5587eaf8030cc63 1 parent 52342b6
ali asaria authored

Showing 3 changed files with 24 additions and 1 deletion. Show diff stats Hide diff stats

  1. +19 0 README.markdown
  2. +1 1  core.php
  3. +4 0 lib/metrics.php
19 README.markdown
Source Rendered
... ... @@ -0,0 +1,19 @@
  1 +A/B TESTING FOR PHP USING REDIS
  2 +===============================
  3 +
  4 +Introduction
  5 +------------
  6 +
  7 +PHP A/B Testing with Redis is code you can include in your PHP web application to A/B test
  8 +
  9 +To set up this project:
  10 +
  11 +1. Start up redis. Specify the host name and db number in config/configure.php
  12 +2. Define things to measure in config/metrics.php following the declaration pattern in the file's example
  13 +3. Define the tests you'd like to perform in config/tests.php following the pattern there. Specify a metric for each test as shown in the example
  14 +4. include core.php in your code.
  15 +5. make sure to set ab_participant_specify_id("a_unique_id_for_this_user") at least once
  16 +6. for every metric, call: ab_track("name_of_your_metric");
  17 +7. every time you need a choice, call: ab_test("name_of_your_ab_test"); and it will return a string represing the alternative to use
  18 +
  19 +that is all.
2  core.php
@@ -122,7 +122,7 @@ function ab_track($metric, $value = 1)
122 122 {
123 123 if ($ab_participant_id != -1)
124 124 {
125   - ab_metrics_track($metric, $value = 1);
  125 + ab_metrics_track($metric, $value);
126 126 }
127 127 }
128 128 else
4 lib/metrics.php
@@ -60,6 +60,10 @@ function ab_values($metric, $from, $to)
60 60
61 61 $ut_diff_in_days = $ut_diff / 24 / 60 / 60;
62 62
  63 +
  64 + //i am adding an extra day just to fix the bug.
  65 + //this whole function needs to be rewritten with proper math
  66 + $ut_diff_in_days += 1;
63 67 //if ($ut_diff_in_days > 90) $ut_diff_in_days = 90;
64 68
65 69 if ($ut_diff_in_days < 1) $ut_diff_in_days = 0;

0 comments on commit daae64e

Please sign in to comment.
Something went wrong with that request. Please try again.