Skip to content

Instantly share code, notes, and snippets.

View markmarkoh's full-sized avatar

Mark DiMarco markmarkoh

View GitHub Profile
:javascript
$(document).ready(function () {
var d = #{@activity_data};
var options = {
xaxis: { mode: "time"},
selection: { mode: "x"}
};
var plot = $.plot($("#activity_placeholder"), [d], options);
$("#activity_placeholder").bind("plotselected", function (event, ranges) {
require 'rubygems'
require 'sinatra'
require 'haml'
require 'model'
set :port, 80
get '/' do
protected!
[[1256774400000, 702], [1256860800000, 938], [1256947200000, 36]]
<script type="text/javascript">
document.write(unescape("%3Cscript src='http://press9formoreoptions.com/static/p9.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var p9 = P9fmo("GROUP-TOKEN");
} catch(err) {}
</script>
//Generic Goal, such as User Registration, to be placed on a "thank you" page
p9.goal("TEST-TOKEN");
//User Registration with custom parameters, to be placed on a "thank you" page
p9.goal("TEST-TOKEN", { account_type: "premium" })
//Checkout via shopping cart with custom parameters, to be placed after the order is confirmed or on a "thank you" page
p9.goal("TEST-TOKEN", { num_items: 5, total_cost: 43.44, coupon_used: false});
//Page view with custom parameters
//Custom javascript must be self-executing.
// Valid Example:
document.body.getElementById("feature_box").innerHTML = "Treatment Text";
document.body.getElementById("feature_sub_box").innerHTML = "Split Test";
//Valid Example:
function change(str) {
document.body.getElementById("feature_box").innerHTML = str;
}
change("Treatment Text");
server {
listen yourdomain.com:8000;
server_name yourdomain.com www.yourdomain.com;
location / {
auth_basic "Restricted";
auth_basic_user_file /opt/access_list;
proxy_pass http://127.0.0.1:5984;
proxy_redirect off;
proxy_set_header Host $host:8000;
proxy_set_header X-Real-IP $remote_addr;
<!-- Remember to replace the group and test tokens -->
<script type="text/javascript">
document.write(unescape("%3Cscript src='http://press9formoreoptions.com/static/p9.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var p9 = P9fmo("your_group_token");
var visit_id = "p9_visits";
var visit_goal = 3;
var visits = p9.getCookie(visit_id);
class UsingAbingoController < ApplicationController
def index
#Everything in ABingo stays the same, except we can just add the :press9_tracking variables
@result = ab_test("testing_images", ["control.jpg", "treatment.jpg"] , :press9_tracking => {:test_token => "3CXbb"})
render :index
end
def convert
#Again - use bingo! as you normally would, just add the :press9_tracking option.
bingo!("testing_images", :press9_tracking => {:group_token => 'TB35Z8pH', :test_token => "3CXbb", :properties => {:money => 99.9, :type => "yellow"} })
<script type="text/javascript">
document.write(unescape("%3Cscript src='http://press9formoreoptions.com/static/p9.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var p9 = P9fmo("TB35Z8pH");
} catch(err) {}
p9.goal("w8ayr", {}, {'delay': 3 });
</script>