Connect Novaco to Google Analytics

    Forward the events from your virtual assistant to Google Tag Manager or Google Analytics 4 and report on conversations, leads and appointments.

    Two methods

    There are two ways to connect Novaco data to Google Analytics. Pick one — never run both in parallel.

    Which events are available? See the Google Analytics events reference.

    Connect with Google Tag Manager

    GTM distributes events to third parties through tags. To do so, you provide the data in the so-called "data layer". Add a listener for every event you want to use.

    Example: one event

    <script>
    window.addEventListener('autochat_lead_created', function (e) {
      try {
        dataLayer.push({
          "event": e.type,
          "autochat_event_details": e.detail.eventData
        });
      } catch(e) {
        // Your error handling if relevant
      }
    });
    </script>

    Example: multiple events

    <script>
    window.addEventListener('autochat_lead_created', function (e) {
      try {
        dataLayer.push({
          "event": e.type,
          "autochat_event_details": e.detail.eventData
        });
      } catch(e) {
        // Your error handling if relevant
      }
    });
    window.addEventListener('autochat_chat_first_user_interaction', function (e) {
      try {
        dataLayer.push({
          "event": e.type,
          "autochat_event_details": e.detail.eventData
        });
      } catch(e) {
        // Your error handling if relevant
      }
    });
    </script>

    The try-catch is optional error handling — you can leave it as is.

    Create the data layer variables

    Alongside the events, Novaco provides additional event data such as session_id, chat_type and appointment_type. Create a variable for each one.

    1. Go to your GTM container.
    2. Go to Variables and click "New" under "User-Defined Variables".
    3. Pick "Data Layer Variable" as the variable type.
    4. Give it a clear name, for example "Novaco – session_id".
    5. As the data layer variable name, fill in the Novaco variable name.
    6. Click Save.

    Link the events to triggers and tags

    Create a trigger for every event you want to act on, then combine triggers and variables in a GA4 tag.

    Create a trigger

    1. Go to your GTM container.
    2. Go to Triggers and click "New".
    3. Pick trigger type "Custom event".
    4. Give it a clear name, for example "Novaco – Lead created".
    5. Use the Novaco event name as the event name.
    6. Click Save.

    Create the GA4 tag

    1. Go to Tags and click "New".
    2. Pick tag type "Google Analytics: GA4 Event".
    3. Give it a clear name, for example "GA4 – Novaco events".
    4. Fill out your measurement ID or link it to your Google tag config.
    5. Fill out {{Event}} as the event name.
    6. Under "Event parameters", add the Novaco variables as parameters.
    7. Click Save.

    Any Novaco event trigger you add now automatically sends its data to GA4. The same building blocks can be used for other tags, such as a Google Ads lead conversion.

    Connect directly to Google Analytics 4

    No tag manager? Use the Google tag (gtag.js) implementation. Never run this setup in parallel with Google Tag Manager — if you use GTM, follow the guide above instead.

    1. Set up your Google tag

    <script async src="https://www.googletagmanager.com/gtag/js?id=G-12345678"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
    
      gtag('config', 'G-12345678');
    </script>

    Replace G-12345678 with your own measurement ID.

    2. Add the Novaco event tracking

    Add this snippet after your gtag('config', ...) call.

    <script>
    window.addEventListener('autochat_lead_created', function (e) {
      try {
        gtag('event', e.type, {
          'session_id': e.detail.eventData.session_id,
          'appointment_type': e.detail.eventData.appointment_type
        });
      } catch(e) {
        // Your error handling if relevant
      }
    });
    window.addEventListener('autochat_chat_first_user_interaction', function (e) {
      try {
        gtag('event', e.type, {
          'session_id': e.detail.eventData.session_id,
          'chat_type': e.detail.eventData.chat_type
        });
      } catch(e) {
        // Your error handling if relevant
      }
    });
    </script>

    e.type automatically resolves to the event name, for example autochat_lead_created. That is also the event name you will see in GA4. Everything after it are the event parameters.

    GA4 custom dimensions

    To report on the event parameters, register them as custom dimensions in GA4.

    1. Go to your GA4 property admin.
    2. Go to "Custom definitions".
    3. Go to "Custom dimensions" and click "Create custom dimension".
    4. Use a descriptive dimension name, for example "Novaco chat open type".
    5. Set the scope to "Event".
    6. As the event parameter, use the variable name you used in the GA4 tag, for example chat_open_type.

    analyticsSetup.dimensions.note

    Looking for the event list?

    Every event, when it fires and which data it carries.

    View the events reference