I have a piece of JS code which uses a public API by ipify to access my/or clients' IP address. I was essentially wondering if I could somehow print the json.ip (IP address) to the console)? It seems fairly obvious but I can't make it work.
  <script type="application/javascript">
  function getIP(json) {
    dataLayer.push({"event":"ipEvent","ipAddress" : json.ip});  
  }
</script>
<script type="ap.....
 
    