Skip to content

Instantly share code, notes, and snippets.

View markmarkoh's full-sized avatar

Mark DiMarco markmarkoh

View GitHub Profile
//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>
@markmarkoh
markmarkoh / gist:656047
Created October 31, 2010 02:43
console helper
window.console = window.console || {log: function(m) {}, info: function(m) {}};
@markmarkoh
markmarkoh / gist:900237
Created April 3, 2011 06:26
Javascript Regex Shorthand trick
//In Javascript, a Regex object can be called like a function
//like: /test/("is test in here")
searchText = "padding 1234 rocket str austin TX 78704 more padding"
/\d+.+\n{0,2}.+\s+[A-Z]{2}\s+\d{5}/m(searchText)
//returns: ["1234 rocket str austin TX 78704"]
//As opposed to the more verbose(but sometimes more appropriate in cases that you are reusing the Regex):
$(function() {
var tocWrapper = $("#toc .wrapper");
$("#mainContainer h1").each(function(i,item) {
$("<a />")
.text( $(item).text() )
.attr("href","#")
.data("scrollTo",item)
@markmarkoh
markmarkoh / gist:1106127
Created July 26, 2011 06:37
package.json
{
"name": "watch.js",
"description": "A script and stylesheet reloader. Less browser refreshing.",
"version": "0.0.5",
"author": "Mark DiMarco (@markmarkoh)",
"engines": {
"node": ">= 0.4.0"
},
"dependencies": {
"socket.io": "0.7.7"