My iphone randomly restarted?

My iphone just randomly restarted while i was on a shady website on safari and i'm worried i'm being watched through my camera or being tracked what should i do

Random restart wouldn't necessarily mean you're tracked. Look for any additional apps installed on your device. If they look odd, remove.
Do this and restart the phone.
http://www.accessc.com/articles/clear-history-cookies-cache-iphone-ipad-ipod-touch.html

If it continues, it's symptomatic of a software/hardware dislike. Make a backup copy of your data on iCloud and/or iTunes and then factor reset the phone. Put back your stuff slowly and carefully to see if it happens again.
http://www.digitaltrends.com/mobile/how-to-factory-reset-an-iphone/#!G0qBL
Best luck.

The best safety precaution would be to update or restore your iPhone you shouldn't take a risk if your are not satisfied because with todays technology anything can happen

if you have any more questions please contact me on ahsan.saleem1@rocketmail.com