Docs / Introduction / 

Track Website Visitors and Forms

Track Website Visitors and Forms

Track page views and form submissions with custom JavaScript.

This page contains instructions for custom scripting of page view and browser event tracking.

For most funnels, the 'Get Code' tab in the Able CDP Dashboard can be used to generate tracking code automatically, instead of the manual instructions.

Tracking Page Views

Add following code to the website to track website events:

<script type="text/javascript" src="https://app.ablecdp.com/ue.js"></script>
<script>
  window.addEventListener('DOMContentLoaded', function () {
  	uipe('init', '%%FUNNEL_MARK%%')
    uipe('track', 'PageView')
  })
</script>

Where %%FUNNEL_MARK%% is the unique code of your Able CDP Funnel.

Able CDP page view tracking doesn't install its own cookies and relies on third-party identifiers such as Google Analytics Client Id to connect customer activity between website pages. Please enable cross-domain measurement in Google Analytics if your landing and lead/order pages are hosted on different domains.

Tracking Lead Forms

When a visitor leaves contact details, such as by submitting a lead form or signing up, send Lead event to associate visitor with the contact details. For example:

<script>
var uipe_form = document.querySelector(`form`)
if (uipe_form) {
  uipe_form.addEventListener('submit', function () {
    uipe('track', 'Lead', {
      keys: {
        email: uipe_form.elements['email'].value,
        phone: uipe_form.elements['phone'].value,
      },
      lead: {
        firstName: uipe_form.elements['name'].value,
      },
      message: uipe_form.elements['message'].value,
    })
  })
}
</script>

See the Send Events Using Webhooks document for detailed description of possible keys and other event parameters.

We also have special instructions for tracking Hubspot Forms and Shopify leads and purchases.

The exact way how tracking of leads and sign-ups should be done depends on the implementation of the form you're using to capture leads.

We appreciate that this approach makes it a little harder to install the lead tracking code. We chose to use it as it gives our customers full control over the data that are sent to Able, as well as allows you to achieve best in-browser performance. Please contact Able CDP support if you need any help with the form tracking set up.