Skip to content

Commit c44a8ab

Browse files
committed
Fix the broken "create a metric via code" README example
1 parent 8f67693 commit c44a8ab

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

‎README.md‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -636,11 +636,15 @@ the experiment name:
636636
ab_finished(:my_metric)
637637
```
638638

639-
You can also create a new metric by instantiating and saving a new Metric object.
639+
You can also create a new metric by instantiating and saving a new Metric
640+
object. A metric groups one or more experiments (`Split::Experiment` objects)
641+
under a name and is persisted to Redis:
640642

641643
```ruby
642-
Split::Metric.new(:my_metric)
643-
Split::Metric.save
644+
signup = Split::ExperimentCatalog.find_or_create("signup_form", "control", "blue")
645+
checkout = Split::ExperimentCatalog.find_or_create("checkout_flow", "control", "one_page")
646+
647+
Split::Metric.new(name: :conversion, experiments: [signup, checkout]).save
644648
```
645649

646650
#### Goals

0 commit comments

Comments
 (0)