check for undefined  before calling $.each

calling `$.each` with `undefined` as argument throws an exception, I've added a guard to check for it.
the second commit is for adjusting tracker attribute to trackerName rather than the tracker object  when sending a message.