Log a conversion

Log a conversion to analyze alongside other location activity in your app

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
    <link href="https://js.radar.com/v4.4.8/radar.css" rel="stylesheet">
    <script src="https://js.radar.com/v4.4.8/radar.min.js"></script>
  </head>

  <body>
    <div id="map" style="width: 100%; height: 500px;" />

    <script>
      $('#log-conversion').click(() => {
        Radar.initialize('<RADAR_PUBLISHABLE_KEY>');

        const conversionOptions = {
          name: $('#name').val(),
          userId: $('#user-id').val(),
          revenue: $('#revenue').val(),
        };

        Radar.logConversion(options).then(({ event }) => {
          console.log(event);
        });
      });
    </script>
  </body>
</html>