Permalink
Browse files

Added email section to sidebar, fixed some of the styling.

  • Loading branch information...
1 parent fd3ee59 commit 90bb175b4af073d8d5b0e3b1f5678ee84fbdb150 @assaf assaf committed Jul 29, 2011
Showing with 23 additions and 38 deletions.
  1. +1 −1 Rakefile
  2. +1 −0 doc/_layouts/page.html
  3. +21 −37 doc/{action_mailer.textile → email.textile}
View
2 Rakefile
@@ -115,7 +115,7 @@ end
desc "Jekyll generates the main documentation (sans API)"
task(:jekyll) { sh "jekyll", "doc", "html" }
file "html/vanity.pdf"=>:jekyll do |t|
- pages = %w{index metrics ab_testing rails identity configuring contributing}.map{ |p| "html/#{p}.html" }
+ pages = %w{index metrics ab_testing rails email identity configuring contributing}.map{ |p| "html/#{p}.html" }
args = %w{--disable-javascript --outline --title Vanity --header-html doc/_layouts/_header.html --print-media-type}
args.concat %w{--margin-left 20 --margin-right 20 --margin-top 20 --margin-bottom 20 --header-spacing 5}
args.concat pages << t.name
View
1 doc/_layouts/page.html
@@ -24,6 +24,7 @@
<li><a href="metrics.html">Metrics</a></li>
<li><a href="ab_testing.html" title="Everything you need to know">A/B Testing</a></li>
<li><a href="rails.html">Using with Rails</a></li>
+ <li><a href="email.html">Testing emails</a></li>
<li><a href="identity.html">Managing Identity</a></li>
<li><a href="configuring.html">Configuring</a></li>
<li><a href="contributing.html">Contributing</a></li>
View
58 doc/action_mailer.textile → doc/email.textile
@@ -1,6 +1,6 @@
---
layout: page
-title: Vanity & ActionMailer
+title: Testing Emails
---
<div id="toc">
@@ -11,9 +11,7 @@ title: Vanity & ActionMailer
h3(#config). Configuring ActionMailer
-First setup Rails to send email. For example, if you are using gmail you can setup your SMTP settings like this:
-
-in RAILS_ROOT/config/environment.rb
+First setup Rails to send email. For example, if you are using GMail you can setup your SMTP settings like this:
<pre>
ActionMailer::Base.smtp_settings = {
@@ -29,9 +27,7 @@ ActionMailer::Base.smtp_settings = {
h3(#subject). Testing email subject lines
-In your RAILS_ROOT/experiments/ folder create an experiment file.
-
-e.g. invite_subject.rb:
+In your @RAILS_ROOT/experiments/@ folder create an experiment file. For example:
<pre>
ab_test "Invite subject" do
@@ -41,54 +37,48 @@ ab_test "Invite subject" do
end
</pre>
-In your RAILS_ROOT/experiments/metrics/ folder create a metric file for the metric you are testing.
-
-e.g. open.rb
+In your @RAILS_ROOT/experiments/metrics/@ folder create a metric file for the metric you are testing. For example:
<pre>
metric "Open (Activation)" do
description "Measures how many recipients opened an email."
end
</pre>
-Create an ActionMailer class
-
-e.g. invite_mailer.rb
+Create an ActionMailer class, for example:
<pre>
-class VanityMailer < ActionMailer::Base
+class UserMailer < ActionMailer::Base
def invite_email(user)
- use_vanity_mailer(user)
- mail(:to => user.email,
- :subject => (ab_test :invite_subject))
+ use_vanity_mailer user
+ mail :to => user.email, :subject =>ab_test(:invite_subject)
end
end
</pre>
-We set the identity of the "user" in the use_vanity_mailer method. This can take a string or an object that responds to id. If it's nil then it will set it as a random number. Setting the appropriate context is important to have each user consistently get the same alternative in our experiment.
+We set the identity of the "user" in the @use_vanity_mailer@ method. This can take a string or an object that responds to id. If it's nil then it will set it as a random number. Setting the appropriate context is important to have each user consistently get the same alternative in our experiment.
+Now we need to include a tracking image in the email content. We pass in the vanity identity which we set when we called @use_vanity_mailer(user)@ and the metric we are tracking.
-Now we need to include a tracking image in the email content.
-We pass in the vanity identity which we set when we called use_vanity_mailer(user) and the metric we are tracking.
<pre>
<!DOCTYPE html>
<html>
<head>
- <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body>
<h1>Hey Joseph</h1>
<p>
<%= vanity_tracking_image(Vanity.context.vanity_identity, :open, :host => "127.0.0.1:3000") %>
</p>
- </body>
+ </body>
</html>
</pre>
+Last, we have to include the @TrackingImage@ module into our @VanityController@. This is the same place that you can include the @Dashboard@.
+
+@Vanity::Rails::TrackingImage@ will add a image method that will render a blank image.
-Then we have to include the TrackingImage module into our VanityController.
-This is the same place that you can include the Dashboard.
-Vanity::Rails::TrackingImage will add a image method that will render a blank img.
<pre>
class VanityController < ApplicationController
include Vanity::Rails::Dashboard
@@ -99,9 +89,7 @@ end
h3(#subject). Testing email content
-In your RAILS_ROOT/experiments/ folder create a new experiment file.
-
-e.g. invite_text.rb:
+In your @RAILS_ROOT/experiments/@ folder create a new experiment file:
<pre>
ab_test "Invite text" do
@@ -111,25 +99,21 @@ ab_test "Invite text" do
end
</pre>
-In your RAILS_ROOT/experiments/metrics/ folder create a metric file for the metric you are testing.
-
-e.g. click.rb
+In your @RAILS_ROOT/experiments/metrics/@ folder create a metric file for the metric you are testing:
<pre>
metric "Click (Acquisition)" do
description "Measures clickthough on email."
end
</pre>
-A/B test your email content
-
-e.g. invite_email.html.erb
+A/B test your email content:
<pre>
<!DOCTYPE html>
<html>
<head>
- <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body>
<h1>Hi!</h1>
@@ -140,6 +124,6 @@ e.g. invite_email.html.erb
</html>
</pre>
-Here we use the text from the "invite_text" experiment and then use the vanity_track_url_for helper to add the identity and the metric to track into the url so that Vanity can track the clickthroughs.
+Here we use the text from the "invite_text" experiment and then use the @vanity_track_url_for@ helper to add the identity and the metric to track into the url so that Vanity can track the click-throughs.
-Remember: By default, Vanity only collects data in production mode.
+Remember: By default, Vanity only collects data in production mode.

0 comments on commit 90bb175

Please sign in to comment.