Created
January 3, 2012 21:54
Revisions
-
Paul Asmuth revised this gist
Jan 23, 2012 . 1 changed file with 4 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -9,7 +9,10 @@ { "_type": "_set_name", "name": "Tingle Tangle Bob", "_session": "mysessiontoken" } # set the user picture { "_type": "_set_picture", "url": "http://myhost/123.jpg", "_session": "mysessiontoken" } # track a pageview { "_type": "_pageview", "url": "http://myhost/mypath", "_session": "mysessiontoken" } -
Paul Asmuth created this gist
Jan 3, 2012 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,49 @@ # i hope this helps... # to set the username and picture send these events to fm # -> you don't need to define any event handlers # -> the session token (_session) could be your unique session id # or the unique user id (it's hashed) # set the user name { "_type": "_set_name", "name": "Tingle Tangle Bob", "_session": "mysessiontoken" } # set the user picture { "_type": "_set_picture", "url": "http:#myhost/123.jpg", "_session": "mysessiontoken" } # if you want to count action/events unique per session you can # set up an event handler like this: gauge :myaction_uniqe, :tick => 1.day.to_i, :unique => true event :myaction do incr :myaction_uniqe end # and send events like this one: { "_type": "myaction", "_session": "mysesstiontoken" } # the gauge will only be incremented once per session token (and tick/interval) # so this gauge would show "daily unique myactions" # if you want e.g. the average body size of all users on a given day: gauge :average_body_size, :tick => 1.day.to_i, :unique => true, :average => true event :user_body_info do incr :average_body_size, data[:body_size] end # events: { "_type": "user_body_info", "body_size": 186, "_session": "userid_1" } { "_type": "user_body_info", "body_size": 162, "_session": "userid_2" } { "_type": "user_body_info", "body_size": 173, "_session": "userid_3" }