Tracking Meeting Events, Setting as a Goal in Google Analytics with GTM


I spent hours upon hours trying build a report that would show me visitors that landed on our website and signed up for a demo meeting. Below is my solution to track visitors that:

  1. Landed on website
  2. Clicked on sign up for demo
  3. Scheduled demo meeting

Here's my solution using GTM (Google Tag Manager):


1) Create a trigger using Page view, I set to all pages being it only triggers based on the listener. 



2) Next, We'll create a custom HTML tag listener, apply the above trigger to this listener.

This listens for if a person creates / schedules a meeting using the HS calendar meeting feature embedded on your website.


<script type="text/javascript">
  function isOmnidekUrls(url) {
    var omnidekUrls = [
    return omnidekUrls.indexOf(url) > -1;

// hubspot meetings uses postMessage api to send various events
  function receiveMessage(event) {
   if (isOmnidekUrls(event.origin) && {
         dataLayer.push({'event': 'meeetingBookSucceeded'});
  // there is a typo in the event fired by hubspot. `meeetingBookSucceeded`
  //  is the correct attribute to watch for.
  if (isOmnidekUrls(event.origin) && {
    dataLayer.push({'event': 'meetingCreated'});
    console.log('hubspot meetings: meeetingBookSucceeded event');
      'event': 'hubspot-form-success',

window.addEventListener('message', receiveMessage)



3) We'll create a second trigger that will fire if the above event happens.



4) Now, we're going to create a virtual pageview based on an event, this step took me some time to discover. 

We create a virtual pageview if the trigger above fires. See screenshot for details



As for the goal I setup in google analytics, is straight forward. Now please note I also created an event and virtual pageview for the click of our signup button to setup this goal.



Now you may view this goal in a funnel visulization and also in a table report to see website visitors to demo signup conversions and more...

2 Replies 2
Community Manager

Thanks for sharing @Omnidek!


Thanks @jennysowyrda


I know this solution may seem technical, please reach out to me for assistance, I do not mind.