# Add Privatus Analytics to Calendly

> Count Calendly bookings in your analytics by listening for the embed's scheduled event on your own website and sending a Booking event without personal data.

Calendly's hosted booking pages don't take custom scripts. Instead, embed
Calendly on your own site, add the [snippet](/docs/install/html) there, and
count bookings from the embed's browser messages.

1. Add the Privatus Analytics snippet to the page that holds the embed:

   ```html
   <script defer src="https://privatusstats.com/js/pa.js" data-site="pa_YOURSITEID" data-modules="engage,auto,vitals,clicks,ask"></script>
   ```

2. Use Calendly's inline, popup or JavaScript embed. The plain iframe code
   does not send these events.
3. Add a listener after the embed:

   ```html
   <script>
     window.addEventListener('message', function (e) {
       if (e.origin === 'https://calendly.com' &&
           e.data && e.data.event === 'calendly.event_scheduled') {
         window.privatus && privatus.track('Booking');
       }
     });
   </script>
   ```

Calendly documents these messages in
[Advanced Calendly embed for developers](https://calendly.com/help/advanced-calendly-embed-for-developers).
The event also carries a payload with event and invitee links. Don't pass it
on. The `Booking` event needs no properties, and it never includes a name or
email address.

Other messages from the embed, such as `calendly.date_and_time_selected`,
can be tracked the same way if you want a funnel step before the booking.
