Skip to content

Instantly share code, notes, and snippets.

@scotttam
Created January 26, 2011 20:56
Show Gist options
  • Save scotttam/797439 to your computer and use it in GitHub Desktop.
Save scotttam/797439 to your computer and use it in GitHub Desktop.
Recording app start times with mixpanel.rb
#If you see 1 on the terminal, that's success. 0 is bad.
require 'rubygems'
require 'base64'
require 'json'
event_hash = {}
event_hash['event'] = "app_start"
event_hash['properties'] = {:token => "4130e0e1bf5ade215e80ebc0b7765b6f", :time => Time.now.to_i, :publisher_id => "1234", :app_id => "5678", :start_time => Time.now.to_i}
json64 = Base64.encode64(JSON.generate(event_hash)).gsub("\n", '')
system("curl 'http://api.mixpanel.com/track/?data=#{json64}&test=1'")
puts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment