How to track user's email when they are logged in through fb/google in their website.

I am using hubspot in my own website, so when I enter first msg to huspot chat then it asks me for email address, but whenI logged in into my website then hubspot automatically takes it. but in the same way,when I logged in through fb/google in my website, then hubspot is not tracking it, why?
I tried this way also :

<script type=“text/javascript”>

var _hsq = window._hsq = window._hsq || [];

_hsq.push([‘identify’, {

email: localStorage.getItem(“email”)

}]);

</script>
Please suggest me some solution for this.

Any reply on this?
Please help here.