Detect unsecure ssl-Connection
This is possible, however browser support is not very high at the moment. If you can live with not supporting anything but chromium based browsers and firefox (these do make up the majority of user agents), you can use
window.isSecureContext
to find out, if the browser trusts your cert. So in order to log every time someone does not trust your cert you could do:
if (!window.isSecureContext){
//do ajax call
}