Log visitors IP address immediately in chat

In our line of work we deal mainly with schools - we have had students using our website for their Math work, getting products and pricing together. Sometimes it works great, the students asks a question about pencils and other times the students find it funny to send silly & sometimes rude messages to us. Without being able to access the IP address, we cannot find out where these messages are coming from to be able to call the school and put a stop to it. Yes, we asked the students for their school name, in which they responded, ‘it is private information’, fair enough. But after almost 100 chat messages about farting, where can they find the eggs (we sell stationery) etc etc the list goes on, it would be extremely helpful if we knew where these messages were coming from!