Created
January 26, 2011 20:56
-
-
Save scotttam/797439 to your computer and use it in GitHub Desktop.
Recording app start times with mixpanel.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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