EzDevInfo.com

vanity

Experiment Driven Development for Ruby Vanity — Welcome to Vanity

Adding custom user ID to Vanity's "track!" method

There's a Vanity metric that is tracked by a cronjob, long after the user has left the website.

How should I pass the user ID to the "track!" method to ensure that the conversion is handled properly?


Source: (StackOverflow)

testing with Vanity and with MySQL?

I am trying to find a framework that allows me to do AB testing and I have found several: ABingo, Vanity and 7minutes AB. I am liking ABingo and Vanity and starting to like Vanity more but the bad thing is that Vanity requires Redis (? is this true ?). I am just wondering if there is a workaround to use Vanity with MySQL.


Source: (StackOverflow)

Advertisements

Copy line to clipboard in Windows Command Prompt

@echo off
cd C:\Users\"%username%"\Downloads\vanity\gen
@echo off
set /p Address=""
vanitygen -X 0 1%Address%
@echo off
for /f "tokens=2" %%a in ('vanitygen 1%Address% ^| findstr Privkey ') do echo %%a|clip
msg "%username%" Generation complete! Your private address has been copied to your clipboard!
PAUSE

This code works, however instead of copying the privaddress, it runs the script again, and copies that code. I need it to copy the first result, not the second one, as they will both be different. What can be done to make it only copy the one displayed?


Source: (StackOverflow)

Vanity, Rails 3 and Heroku

I'm trying to get Vanity to play nicely with Heroku and my Rails 3 app. At the moment, it all works fine locally using Pow and a local Redis server, but when I push to Heroku using the RedisToGo add-on, nothing seems to get the server running, I just get the error: getaddrinfo: Name or service not known.

Here's my config/vanity.yml file:

staging:
  adapter: redis
  host: <%= ENV["REDISTOGO_URL"] %> 

and my config/initializers/redis.rb:

uri = URI.parse(ENV["REDISTOGO_URL"])
REDIS = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)

I've also tried using the actual redis://<actualusername>:actualpassword@actualserver.com:9274 and it gives the same error. I've also tried with and without the redis://.

Has anyone got Vanity working with Heroku and Rails 3? Am I missing something terribly obvious? My Google-fu has failed me thus far.


Source: (StackOverflow)

Vanity not using Redis to Go server on Heroku

I've recently deployed some A/B testing experiments using vanity to my heroku instance. However, whenever I access the dashboard i.e. /vanity The following error shows up in the logs

- ActionView::Template::Error (Connection refused - Unable to connect to Redis on 127.0.0.1:6379):
-     1: <ul class="experiments">
-     2:   <% experiments.sort_by { |id, experiment| experiment.created_at }.reverse.each do |id, experiment| %>
-     3:     <li class="experiment <%= experiment.type %>" id="experiment_<%=vanity_h id.to_s %>">
-     4:     <%= render :file => Vanity.template("_experiment"), :locals => { :id => id, :experiment => experiment } %>
-     5:     </li>
-   

However, the redis to go url seems to be set up correctly and vanity seems to be able to access it e.g.

irb(main):011:0> Vanity.playground.connection
=> redis://bluegill.redistogo.com:9231/0

Anyone know what I could be doing wrong ?

 my vanity.rb config file is fairly standard

    development:
      adapter: redis
      connection: redis://localhost:6379/0
    qa:
      adapter: redis
      connection: <%= ENV["REDISTOGO_URL"] %>
    staging:
      adapter: redis
      connection: <%= ENV["REDISTOGO_URL"] %>
    production:
      adapter: redis
      connection: <%= ENV["REDISTOGO_URL"] %>

and also the ENV["REDISTOGO_URL"] seems correct

irb(main):012:0> ENV["REDISTOGO_URL"]
=> "redis://redistogo:e1ab3fa23beacbcd481cd4508ad0090c@bluegill.redistogo.com:9231/"

And I can access Redis from the rest of the app, it just seems that Vanity is not picking it up for this template..


Source: (StackOverflow)

How can I get the participants of a Vanity experiment?

tl:dr

Is there anyway to get something like Vanity.experiment(:landing).participants_for_option(:a) returning a array of users?

The long story

I'm using the gem Vanity with a Rails 4.2 application and it is working nicely, but I want to inspect further the behaviour of participants.

I tested what kind of page converted more users: A classical signup page versus a signup with order page. The classical signup page led to almost three times more signups, but I'm still in the dark in the sense that I don't know, among the signup-only-users, how many ordered a product.


Source: (StackOverflow)

Can't Install Vanity A/B Testing on Rails

I'm trying to install Vanity A/B Testing in my Rails App, but I can't even get the example from the GitHub page working. I've generated the vanity models and run the migrations and made the experiment files, but as soon as I include a test like

<%= ab_test :price_options %>

the program throws an error:

invalid value for Integer(): "{:conditions=>{:experiment_id=>\"price_options\""

In my controllers/application_controller.rb I have just:

class ApplicationController < ActionController::Base
  # Prevent CSRF attacks by raising an exception.
  # For APIs, you may want to use :null_session instead.
  protect_from_forgery with: :exception
  use_vanity
end

I didn't include a user identifier because I haven't built one into this app yet, but the Vanity docs say that if no argument is supplied Vanity will just use cookies instead, so that shouldn't be an issue. If anyone has any clue why this cryptic error is being thrown, I would be very appreciative!

Edit: I should add that I actually started a new rails app from scratch just to try and debug this. Literally all I did was start an app and install vanity following the readme instructions and I got this same error. This has happened on two different machines as well, so I suspect it's something obvious that I'm missing, but I can't be sure (else I wouldn't be here!).

EDIT: I've since decided to use the Split gem instead, and am having no troubles with it.


Source: (StackOverflow)

How do I use an existing Redis connection in Vanity?

I have a Redis add-on in Heroku that only allows 10 connections. My app already uses Redis with $redis. I have Unicorn with 3 workers and 2 dynos, which is 6 connections. Vanity connects by itself which is another 6 connections. That is 12 connections which is over the limit of 10. How do I use the existing $redis connection for Vanity so Vanity and my app share the connection?

I saw this deprecated method, but when I try it, it gives an error and stack trace. It was probably for an old version of Redis client.

http://rdoc.info/gems/vanity/Vanity/Playground#redis%3D-instance_method

I use establish_connection in my Unicorn.rb file to connect, and pass it the connection string. I would like to set the connection or Redis client object directly.

http://rdoc.info/gems/vanity/Vanity/Playground#establish_connection-instance_method

Ruby 2.0.0, Rails 4.0.3, Vanity 1.9.0.


Source: (StackOverflow)

How do I generate a report with Vanity?

Whenever I try to generate a report with Vanity, it creates an empty HTML file

>vanity report --output vanity.html
Vanity: loading experiments from ...
Vanity: loading metrics from ...
New report available in vanity.html

When viewing in the browser

Vanity's cached experiments are out of sync with those on the filesystem and/or those in the datastore. Please restart your server and/or turn on collecting.

I've already restarted the server several times, and ran through the the registration process several times.

>rails server
Vanity: loading experiments from C:/.../experiments
Vanity: loading metrics from C:/.../experiments/metrics
[2014-03-14 04:53:34] INFO  WEBrick 1.3.1

I was able to load the experiment page and see both color options. I have the track! code.

  if @user.save(validate: false)
    track! :register # Vanity

I even see the values in Redis

redis 127.0.0.1:6379> keys *
 1) "vanity:experiments:color_options:outcome"
 2) "vanity:experiments:color_options:created_at"
 3) "vanity:experiments:landing_page:alts:0:conversions"
 4) "vanity:metrics:register:last_update_at"
 5) "vanity:metrics:register:2014-03-14:value:0"
 6) "scores"
 7) "vanity:experiments:color_options:completed_at"
 8) "vanity:experiments:color_options:alts:0:conversions"
10) "vanity:experiments:color_options:alts:1:conversions"
11) "vanity:experiments:color_options:alts:0:participants"
14) "vanity:experiments:color_options:alts:1:converted"
15) "vanity:experiments:color_options:alts:1:participants"
16) "vanity:experiments:landing_page:created_at"

I even added model User to the metric, because it claimed to look at existing historical data.

metric "Registration" do
  description "Measures how many people signed up for our awesome service."
  model User
end

Reference http://vanity.labnotes.org/


Source: (StackOverflow)

Why doesn't vanity create vanity_experiments.rb and similar in app/models

I've create and run my vanity migrations and I can see the resulting tables in schema.rb and the rails console:

ActiveRecord::Base.connection.tables
 => ["schema_migrations", "pages", "users", "areas", "roles", "assignments", "categories", "heuristics", "references", "footnotes", "products", "orders", "vanity_metrics", "vanity_metric_values", "vanity_experiments", "vanity_conversions", "vanity_participants"] 

Why then has it not created vanity_experiments.rb and similar files in app/models?

I understand vanity will be using Redis not my PostgreSQL to store the data, but Rails still maps each table to a model, right?


Source: (StackOverflow)

Vanity not works with MySql

I tried to install Vanity gem for my rails 2.3.5 application and I want to use MySQL for vanity. Everything is working great when I configure it with redis but when I change the config file to use mysql :

development:
  adapter: active_record
  active_record_adapter: mysql
  host: localhost
  database: vanity
  username: root
  password:

I get the following error :

Showing
/Users/dries/.rvm/gems/ruby-1.8.7-p302/gems/vanity-1.5.3/lib/vanity/templates/_ab_test.erb where line #1 raised:

Vanity::Adapters::ActiveRecordAdapter is not missing constant
VanityConversion! Extracted source (around line #1):

1: <% score = experiment.score %> 
2: <table> 
3:   <caption> 
4:     <%= experiment.conclusion(score).join(" ") %></caption> 

Trace of template
inclusion:
/Users/dries/.rvm/gems/ruby-1.8.7-p302/gems/vanity-1.5.3/lib/vanity/templates/_experiment.erb,
/Users/dries/.rvm/gems/ruby-1.8.7-p302/gems/vanity-1.5.3/lib/vanity/templates/_experiments.erb,
/Users/dries/.rvm/gems/ruby-1.8.7-p302/gems/vanity-1.5.3/lib/vanity/templates/_report.erb

I added in environment file development.rb :

Vanity.playground.establish_connection :development
Vanity.playground.collecting = true

So it has to do something with the adapter included in the vanity gem, because redis is working perfect. Somebody who knows a solution?


Source: (StackOverflow)

Vanity (gem) - can I create experiments programmatically via a database table?

I am using Vanity gem and have the basics of experiments & metrics set up fine. I was wondering if anyone has tried to extend it to set up experiments themselves via records in a database.

It seems to me that Vanity is built to initialize its experiments during the app's boot, so this might be working against the design of the tool.

As background, I see myself using this for two distinct kinds of experiments: (1) UX changes that requires a Rails/Javascript developer, and (2) changes of Images and copy which require simply a switch in my custom-built CMS.

Vanity works well for #1, but for #2 I want the admin users of my site to be able to create experiments without involving a Rails/Javascript dev and without deploying code. I could easily implement the switch pull the right content myself, but I'm not sure how Vanity will feel about having experiments defined in a database?


Source: (StackOverflow)

Vanity A/B testing with page caching

I'm using Vanity to do my A/B testing but I also have page caching for the pages the experiment is running on. Because of that, the user will actually see both options as they navigate around the site. I would be fine with that however I know that Vanity keeps track of which option a single user is seeing and attempts to show that same option throughout the site.

So what I'm wondering is, let's say a user comes to my site and views Option A. Vanity (I think) records them as an "Option A" participant. Now that user goes to a different cached page, and because of the caching they see Option B and "converts".

Is vanity going to record that user as an "Option A" conversion or an "Option B" conversion?


Source: (StackOverflow)

Using Images as Vanity Alternatives

I am trying to use Vanity for rails. my ab_test /rag_price_options.rb file is:

    ab_test "Rag price options" do
      description "Different options for displaying the rag price"
      alternatives "banner_194x117_rag.png", "ccp_logo_bk.png"
      metrics :orders
    end

and my metric metrics/order.rb is:

   metric "Orders" do
     description "Measures number of orders, subtotals, order number"
   end

But I'm trying to figure out how to have 2 images as the alternatives that need to go inside a link to field something like this:

   <%= link_to image_tag("banner_194x117_rag.png", :alt=>'Free Rag with purchase over $99!', :width=>194, :height=>117, :style=>'display:block', :class=>'incentive'), "/blog/free-cheap-cycle-rag" %> 

Source: (StackOverflow)

Rails vanity gem custom metric error: private method `to_time' called

Hi I am trying to setup Vanity gem into a rail 3 application. I am creating a custom metric to experiment a bit.

So I created it following the suggestions on their website:

metric "Signups" do
  description "Signups completed"
  def values(from, to)
    (from..to).map { |i| 24 }
  end
end
  • The file is located at the right place and is loaded, vanity picks it up but somehow it looks like there is an internal error in the way vanity works.
  • Of course: those values are only there for a testing purpose, they will be replaced by real ones later.

I get the following error when running this experiment

enter image description here

Thank you!


Source: (StackOverflow)