Sorry for necro... but if someone needs it... you can do also a more 'compressed' version... like this: var callback = function(type, ids) { eventString = "ZWayVDev_zway_" + ids[0] + "-" + ids[1] + "-" + ids[2]; if (ids[3] != 0) { eventString = eventString + "-&quo...