Docs / Integration Tutorials /  

Hint Health

Hint Health Conversion Tracking And Attribution – How To Set Up

Track Hint Health sign-ups and completed payments

Contents

Track Hint Health sign-ups and payments

Track Hint Health sign-ups and subsequent payments, attributing them to visitor sources.

Add Credential

In Able Dashboard, press "Add Service Integration" and select "Hint Health".

Use Integration ID as a name and Practice API Key as a secret.

Enable inbound webhook

In Able Dashboard, press "Add Service Integration" and select "Hint Health".

This will allow Able to track successfully completed customer payments in Hint.

Add tracking code to the Hint Health sign-up form

  1. Reach out to support@hint.com to turn adding of custom JavaScript to online sign-up for you.
  2. Once the feature is turned on, navigate to Admin > Online Signup.
  3. In the text box next to "Add Custom Javascript", paste in your code snippet.

Add the following code:

(function(window, document) {
  function uipe(command, attribute, parameters) {
    const getCookie = function(name) {
      var nameEQ = name + '=';
      var ca = document.cookie.split(';');
      for (var i = 0; i < ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0) == ' ') c = c.substring(1, c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
      }
      return null;
    };

    switch(command) {
      case 'init':
        window.uipeFunnel = attribute;
        break;
      case 'track':
        var resource = Object.assign(parameters || {}, {
          referrer_url: document.referrer,
          event_source: (parameters && parameters.event_source) || document.location.href,
          user_agent: navigator.userAgent,
          keys: parameters && parameters.keys || {},
          lead: parameters && parameters.lead || {},
        });

        var ga_cookie = getCookie('_ga');
        if (ga_cookie != null && ga_cookie != '') {
          resource.keys.ga_cookie = ga_cookie.split('.').slice(2).join('.'); // extract CID
        } else if (attribute === 'PageView' && document.readyState !== 'complete') {
          setTimeout(() => {
            uipe(command, attribute, parameters);
          }, 1500);
          break;
        }

        const dataForBeacon = {
          funnel_mark: window.uipeFunnel,
          event_type: attribute,
          resource: resource,
        };

        let someKeyDefined = false;
        for (const [key, value] of Object.entries(resource.keys)) {
          if (value && value !== '') {
            someKeyDefined = true;
            break;
          }
        }
        
        if (!someKeyDefined) {
          break;
        }

        navigator.sendBeacon('https://app.ablecdp.com/uip-events/event', JSON.stringify(dataForBeacon));
        break;
    }
  }

  window.uipe = uipe;
 
  function initializeTracking() {
    uipe('init', '%%FUNNEL_MARK%%');
    uipe('track', 'PageView');
  }

  if (document.readyState === 'loading') {
    window.addEventListener('DOMContentLoaded', initializeTracking);
  } else {
    initializeTracking();
  }

  function attachFormTracking() {
    const submitButton = document.querySelector('[data-test="next-step-button"]');
    if (submitButton) {
      submitButton.addEventListener('click', function() {
        const formData = {
          keys: {
            email: document.querySelector('#field-Email')?.value || '',
            phone: document.querySelector('[data-test="field-Phone-phone-1"]')?.value || ''
          },
          lead: {
            firstName: document.querySelector('#field-First Name')?.value || '',
            middleName: document.querySelector('[data-test="middle-name"]')?.value || '',
            lastName: document.querySelector('#field-Last Name')?.value || '',
            title: document.querySelector('#title-select-input')?.textContent.replace('Select', '').trim() || '',
            suffix: document.querySelector('[data-test="suffix"]')?.value || ''
          }
        };
        // Track Lead event with Able CDP
        uipe('track', 'Lead', formData);
      });
      return true;
    }
    return false;
  }

  if (!attachFormTracking()) {
    const observer = new MutationObserver((mutations, obs) => {
      if (attachFormTracking()) {
        obs.disconnect();
      }
    });
    observer.observe(document.body, {
      childList: true,
      subtree: true
    });
  }
})(window, document);

Where %%FUNNEL_MARK%% is the identifier of your funnel (available on the Get Code page in Able Dashboard).


Hint Health conversion tracking is commonly used with

References


This page has been written by the Able CDP Customer Success Team, formed of digital marketing practitioners and seasoned marketing data experts.
If you have any questions or suggestions, please contact us using the contact form.