Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@scotttam
Created January 26, 2011 20:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scotttam/797429 to your computer and use it in GitHub Desktop.
Save scotttam/797429 to your computer and use it in GitHub Desktop.
Putting app running time metrics into mixpanel
#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_time"
event_hash['properties'] = {:token => "4130e0e1bf5ade215e80ebc0b7765b6f", :publisher_id => "1234", :app_id => "5678", :time => Time.now.to_i, :duration => rand(10000)}
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