Now that we have all those pieces put together, you should now be able to make calls like the following from within your app:
Foo.identify('John');
Foo.record_action_on_item('view', "HackerNews');
Obviously you'll want to adjust function names, arguments, urls, and the like, to create the proper syntax for the API.